Skip to content

Commit

Permalink
fix: switch to rollup for all instrumentations (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirga authored Mar 15, 2024
1 parent 4e0a830 commit 605fb46
Show file tree
Hide file tree
Showing 29 changed files with 432 additions and 128 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
Expand Down
118 changes: 59 additions & 59 deletions package-lock.json

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

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"@nx/eslint-plugin": "^17.2.8",
"@nx/js": "^17.2.8",
"@nx/linter": "^17.2.8",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-typescript": "^11.1.6",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"cz-conventional-changelog": "^3.3.0",
Expand All @@ -25,6 +27,8 @@
"lerna": "^8.1.2",
"nx": "^17.2.8",
"prettier": "^3.0.3",
"rollup": "^4.13.0",
"rollup-plugin-dts": "^6.1.0",
"typescript": "^5.2.2"
},
"workspaces": [
Expand Down
13 changes: 7 additions & 6 deletions packages/instrumentation-azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "@traceloop/instrumentation-azure",
"version": "0.5.23",
"description": "Azure OpenAI Instrumentaion",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"repository": "traceloop/openllmetry-js",
"scripts": {
"build": "tsc --build tsconfig.json",
"build": "rollup -c",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"test": "ts-mocha -p tsconfig.json 'test/**/*.test.ts'"
Expand All @@ -24,9 +25,9 @@
"node": ">=14"
},
"files": [
"dist/src/**/*.js",
"dist/src/**/*.js.map",
"dist/src/**/*.d.ts",
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"doc",
"LICENSE",
"README.md",
Expand Down
37 changes: 37 additions & 0 deletions packages/instrumentation-azure/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const dts = require("rollup-plugin-dts");
const typescript = require("@rollup/plugin-typescript");
const json = require("@rollup/plugin-json");

// eslint-disable-next-line @typescript-eslint/no-var-requires
const name = require("./package.json").main.replace(/\.js$/, "");

const bundle = (config) => ({
...config,
input: "src/index.ts",
external: (id) => !/^[./]/.test(id),
});

exports.default = [
bundle({
plugins: [typescript.default(), json.default()],
output: [
{
file: `${name}.js`,
format: "cjs",
sourcemap: true,
},
{
file: `${name}.mjs`,
format: "es",
sourcemap: true,
},
],
}),
bundle({
plugins: [dts.default()],
output: {
file: `${name}.d.ts`,
format: "es",
},
}),
];
2 changes: 1 addition & 1 deletion packages/instrumentation-azure/src/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import type {
import { version } from "../package.json";

export class AzureOpenAIInstrumentation extends InstrumentationBase<any> {
protected override _config!: AzureOpenAIInstrumentationConfig;
protected declare _config: AzureOpenAIInstrumentationConfig;

constructor(config: AzureOpenAIInstrumentationConfig = {}) {
super("@traceloop/instrumentation-azure", version, config);
Expand Down
13 changes: 7 additions & 6 deletions packages/instrumentation-bedrock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "@traceloop/instrumentation-bedrock",
"version": "0.5.23",
"description": "Amazon Bedrock Instrumentation",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"repository": "traceloop/openllmetry-js",
"scripts": {
"build": "tsc --build tsconfig.json",
"build": "rollup -c",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"test": "ts-mocha -p tsconfig.json 'tests/**/*.test.ts' --timeout 20000"
Expand All @@ -24,9 +25,9 @@
"node": ">=14"
},
"files": [
"dist/src/**/*.js",
"dist/src/**/*.js.map",
"dist/src/**/*.d.ts",
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"doc",
"LICENSE",
"README.md",
Expand Down
Loading

0 comments on commit 605fb46

Please sign in to comment.