Skip to content

Commit 3303af9

Browse files
committed
Add cerebras instrumentation package
1 parent 446859c commit 3303af9

File tree

16 files changed

+2021
-0
lines changed

16 files changed

+2021
-0
lines changed

package-lock.json

+58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
/coverage
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# OpenTelemetry Cerebras instrumentation for Node.js
2+
3+
[![NPM Published Version][npm-img]][npm-url]
4+
[![Apache License][license-image]][license-image]
5+
6+
This module provides automatic instrumentation for the [`Cerebras Node API Library`](https://www.npmjs.com/package/@cerebras/cerebras_cloud_sdk) module, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package.
7+
8+
Compatible with OpenTelemetry JS API and SDK `1.0+`.
9+
10+
## Installation
11+
12+
```bash
13+
npm install --save @traceloop/instrumentation-cerebras
14+
```
15+
16+
## Supported Versions
17+
18+
- `>=1.29.0`
19+
20+
## Usage
21+
22+
To load a specific plugin, specify it in the registerInstrumentations's configuration:
23+
24+
```js
25+
const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
26+
const {
27+
CerebrasInstrumentation,
28+
} = require("@traceloop/instrumentation-cerebras");
29+
const { registerInstrumentations } = require("@opentelemetry/instrumentation");
30+
31+
const provider = new NodeTracerProvider();
32+
provider.register();
33+
34+
registerInstrumentations({
35+
instrumentations: [new CerebrasInstrumentation()],
36+
});
37+
```
38+
39+
## Useful links
40+
41+
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
42+
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
43+
- For help or feedback on this project, join us on [Slack][slack-url]
44+
45+
## License
46+
47+
Apache 2.0 - See [LICENSE][license-url] for more information.
48+
49+
[slack-url]: https://traceloop.com/slack
50+
[license-url]: https://github.com/traceloop/openllmetry-js/blob/main/LICENSE
51+
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
52+
[npm-url]: https://www.npmjs.com/package/@traceloop/instrumentation-cerebras
53+
[npm-img]: https://badge.fury.io/js/%40traceloop%2Finstrumentation-cerebras.svg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const js = require("@eslint/js");
2+
const rootConfig = require("../../eslint.config.cjs");
3+
4+
const { FlatCompat } = require("@eslint/eslintrc");
5+
6+
const compat = new FlatCompat({
7+
baseDirectory: __dirname,
8+
recommendedConfig: js.configs.recommended,
9+
allConfig: js.configs.all,
10+
});
11+
12+
module.exports = [
13+
{
14+
ignores: ["!**/*", "**/node_modules", "dist/**/*"],
15+
},
16+
...rootConfig,
17+
{
18+
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
19+
rules: {},
20+
},
21+
{
22+
files: ["**/*.ts", "**/*.tsx"],
23+
rules: {},
24+
},
25+
{
26+
files: ["**/*.js", "**/*.jsx"],
27+
rules: {},
28+
},
29+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@traceloop/instrumentation-cerebras",
3+
"version": "0.1.0",
4+
"description": "Cerebras Instrumentation",
5+
"main": "dist/index.js",
6+
"module": "dist/index.mjs",
7+
"types": "dist/index.d.ts",
8+
"repository": "traceloop/openllmetry-js",
9+
"scripts": {
10+
"build": "rollup -c",
11+
"lint": "eslint .",
12+
"lint:fix": "eslint . --fix",
13+
"test": "ts-mocha -p tsconfig.json 'tests/**/*.test.ts' --timeout 20000"
14+
},
15+
"keywords": [
16+
"opentelemetry",
17+
"nodejs",
18+
"tracing",
19+
"attributes",
20+
"semantic conventions"
21+
],
22+
"author": "Harry <[email protected]>",
23+
"license": "Apache-2.0",
24+
"engines": {
25+
"node": ">=14"
26+
},
27+
"files": [
28+
"dist/**/*.js",
29+
"dist/**/*.mjs",
30+
"dist/**/*.js.map",
31+
"dist/**/*.d.ts",
32+
"doc",
33+
"LICENSE",
34+
"README.md",
35+
"package.json"
36+
],
37+
"publishConfig": {
38+
"access": "public"
39+
},
40+
"dependencies": {
41+
"@opentelemetry/core": "^1.29.0",
42+
"@opentelemetry/instrumentation": "^0.56.0",
43+
"@opentelemetry/semantic-conventions": "^1.28.0",
44+
"@traceloop/ai-semantic-conventions": "^0.12.0",
45+
"tslib": "^2.8.1"
46+
},
47+
"devDependencies": {
48+
"@cerebras/cerebras_cloud_sdk": "^1.29.0",
49+
"@pollyjs/adapter-node-http": "^6.0.6",
50+
"@pollyjs/core": "^6.0.6",
51+
"@pollyjs/persister-fs": "^6.0.6"
52+
},
53+
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-cerebras"
54+
}

packages/instrumentation-cerebras/recordings/Test-Cerebras-instrumentation_3871951548/should-set-attributes-in-span-for-completions-streaming_2198009633/recording.har

+223
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)