Skip to content

feat(cerebras): new instrumentation package #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/instrumentation-cerebras/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist
/coverage
4 changes: 4 additions & 0 deletions packages/instrumentation-cerebras/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
53 changes: 53 additions & 0 deletions packages/instrumentation-cerebras/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# OpenTelemetry Cerebras instrumentation for Node.js

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

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.

Compatible with OpenTelemetry JS API and SDK `1.0+`.

## Installation

```bash
npm install --save @traceloop/instrumentation-cerebras
```

## Supported Versions

- `>=1.29.0`

## Usage

To load a specific plugin, specify it in the registerInstrumentations's configuration:

```js
const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
const {
CerebrasInstrumentation,
} = require("@traceloop/instrumentation-cerebras");
const { registerInstrumentations } = require("@opentelemetry/instrumentation");

const provider = new NodeTracerProvider();
provider.register();

registerInstrumentations({
instrumentations: [new CerebrasInstrumentation()],
});
```

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us on [Slack][slack-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[slack-url]: https://traceloop.com/slack
[license-url]: https://github.com/traceloop/openllmetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@traceloop/instrumentation-cerebras
[npm-img]: https://badge.fury.io/js/%40traceloop%2Finstrumentation-cerebras.svg
29 changes: 29 additions & 0 deletions packages/instrumentation-cerebras/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const js = require("@eslint/js");
const rootConfig = require("../../eslint.config.cjs");

const { FlatCompat } = require("@eslint/eslintrc");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

module.exports = [
{
ignores: ["!**/*", "**/node_modules", "dist/**/*"],
},
...rootConfig,
{
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
rules: {},
},
{
files: ["**/*.ts", "**/*.tsx"],
rules: {},
},
{
files: ["**/*.js", "**/*.jsx"],
rules: {},
},
];
54 changes: 54 additions & 0 deletions packages/instrumentation-cerebras/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@traceloop/instrumentation-cerebras",
"version": "0.1.0",
"description": "Cerebras Instrumentation",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"repository": "traceloop/openllmetry-js",
"scripts": {
"build": "rollup -c",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "ts-mocha -p tsconfig.json 'tests/**/*.test.ts' --timeout 20000"
},
"keywords": [
"opentelemetry",
"nodejs",
"tracing",
"attributes",
"semantic conventions"
],
"author": "Harry <[email protected]>",
"license": "Apache-2.0",
"engines": {
"node": ">=14"
},
"files": [
"dist/**/*.js",
"dist/**/*.mjs",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"doc",
"LICENSE",
"README.md",
"package.json"
],
"publishConfig": {
"access": "public"
},
"dependencies": {
"@opentelemetry/core": "^1.29.0",
"@opentelemetry/instrumentation": "^0.56.0",
"@opentelemetry/semantic-conventions": "^1.28.0",
"@traceloop/ai-semantic-conventions": "^0.12.0",
"tslib": "^2.8.1"
},
"devDependencies": {
"@cerebras/cerebras_cloud_sdk": "^1.29.0",
"@pollyjs/adapter-node-http": "^6.0.6",
"@pollyjs/core": "^6.0.6",
"@pollyjs/persister-fs": "^6.0.6"
},
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-cerebras"
}

Large diffs are not rendered by default.

Loading