@vercel/otel 0.0.1 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/index.edge.d.ts +1 -0
- package/dist/index.edge.js +5 -0
- package/dist/index.edge.js.map +1 -0
- package/dist/index.node.d.ts +3 -0
- package/dist/index.node.js +16 -0
- package/dist/index.node.js.map +1 -0
- package/package.json +27 -17
- package/.github/workflows/build.yml +0 -33
- package/src/index.edge.ts +0 -4
- package/src/index.node.ts +0 -24
- package/tsconfig.browser.json +0 -7
- package/tsconfig.edge.json +0 -7
- package/tsconfig.json +0 -22
- package/tsconfig.node.json +0 -8
package/README.md
CHANGED
|
@@ -12,7 +12,9 @@ Use that hip style for Readme that many JS devs use. Keep it concise.
|
|
|
12
12
|
|
|
13
13
|
# 🚀 Vercel Otel
|
|
14
14
|
|
|
15
|
-
[](https://www.npmjs.com/package/@vercel/otel)
|
|
16
|
+
|
|
17
|
+
> **Note:** This package is experimental. Updates can contain breaking changes.
|
|
16
18
|
|
|
17
19
|
`vercel/otel` is a simple and easy-to-use package that sets up your trace provider and exporter, and bundles all OpenTelemetry APIs in a single package. It's not as powerful as using raw APIs, but it should be enough for most cases.
|
|
18
20
|
|
|
@@ -27,10 +29,10 @@ npm install vercel/otel
|
|
|
27
29
|
## 📚 Usage
|
|
28
30
|
|
|
29
31
|
```javascript
|
|
30
|
-
const {
|
|
32
|
+
const { registerOTel, trace } = require("vercel/otel");
|
|
31
33
|
|
|
32
34
|
// Register the OpenTelemetry provider with an HTTP exporter
|
|
33
|
-
|
|
35
|
+
registerOTel("your-service-name");
|
|
34
36
|
|
|
35
37
|
// Now you can use the OpenTelemetry APIs
|
|
36
38
|
const span = trace.getTracer("your-component").startSpan("your-operation");
|
|
@@ -38,7 +40,7 @@ const span = trace.getTracer("your-component").startSpan("your-operation");
|
|
|
38
40
|
|
|
39
41
|
## 📖 API Reference
|
|
40
42
|
|
|
41
|
-
### `
|
|
43
|
+
### `registerOTel(serviceName: string)`
|
|
42
44
|
|
|
43
45
|
Registers the OpenTelemetry provider with an HTTP exporter using the given service name.
|
|
44
46
|
This is all that is needed to trace your app on Vercel.
|
|
@@ -55,4 +57,4 @@ This package re-exports everything from `@opentelemetry/api`. Refer to the offic
|
|
|
55
57
|
|
|
56
58
|
---
|
|
57
59
|
|
|
58
|
-
Made with 💖 by
|
|
60
|
+
Made with 💖 by Vercel. Happy tracing! 📈
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const registerOTel: (serviceName: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.edge.js","sourceRoot":"","sources":["../src/index.edge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAE,EAAE;IAClD,oCAAoC;IACpC,KAAK,WAAW,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "@opentelemetry/api";
|
|
2
|
+
import { Resource } from "@opentelemetry/resources";
|
|
3
|
+
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
4
|
+
import { NodeTracerProvider, SimpleSpanProcessor, } from "@opentelemetry/sdk-trace-node";
|
|
5
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
6
|
+
export const registerOTel = (serviceName) => {
|
|
7
|
+
const provider = new NodeTracerProvider({
|
|
8
|
+
resource: new Resource({
|
|
9
|
+
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
provider.register();
|
|
13
|
+
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({})));
|
|
14
|
+
return provider;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.node.js","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAE,EAAE;IAClD,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC;QACtC,QAAQ,EAAE,IAAI,QAAQ,CAAC;YACrB,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,WAAW;SACvD,CAAC;KACH,CAAC,CAAC;IAEH,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAEpB,QAAQ,CAAC,gBAAgB,CAAC,IAAI,mBAAmB,CAAC,IAAI,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE9E,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/otel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Vercel wrapper around OpenTelemetry APIs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
5
9
|
"types": "./dist/index.node.d.ts",
|
|
6
10
|
"exports": {
|
|
7
11
|
".": {
|
|
@@ -13,6 +17,10 @@
|
|
|
13
17
|
"types": "./dist/index.edge.d.ts",
|
|
14
18
|
"default": "./dist/index.edge.js"
|
|
15
19
|
},
|
|
20
|
+
"browser": {
|
|
21
|
+
"types": "./dist/index.edge.d.ts",
|
|
22
|
+
"default": "./dist/index.edge.js"
|
|
23
|
+
},
|
|
16
24
|
"worker": {
|
|
17
25
|
"types": "./dist/index.edge.d.ts",
|
|
18
26
|
"default": "./dist/index.edge.js"
|
|
@@ -28,19 +36,13 @@
|
|
|
28
36
|
"node": {
|
|
29
37
|
"types": "./dist/index.node.d.ts",
|
|
30
38
|
"default": "./dist/index.node.js"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
},
|
|
40
|
+
"default": "./dist/index.node.js"
|
|
41
|
+
}
|
|
34
42
|
},
|
|
35
43
|
"repository": {
|
|
36
44
|
"type": "git",
|
|
37
|
-
"url": "https://github.com/vercel/
|
|
38
|
-
"directory": "packages/otel"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "pnpm build:node && pnpm build:edge",
|
|
42
|
-
"build:node": "tsc --project tsconfig.node.json",
|
|
43
|
-
"build:edge": "tsc --project tsconfig.edge.json"
|
|
45
|
+
"url": "https://github.com/vercel/otel.git"
|
|
44
46
|
},
|
|
45
47
|
"license": "MIT",
|
|
46
48
|
"devDependencies": {
|
|
@@ -48,10 +50,18 @@
|
|
|
48
50
|
"typescript": "^4.8.4"
|
|
49
51
|
},
|
|
50
52
|
"dependencies": {
|
|
51
|
-
"@opentelemetry/api": "1.4.1",
|
|
52
|
-
"@opentelemetry/exporter-trace-otlp-
|
|
53
|
-
"@opentelemetry/resources": "1.
|
|
54
|
-
"@opentelemetry/sdk-trace-
|
|
55
|
-
"@opentelemetry/
|
|
53
|
+
"@opentelemetry/api": "^1.4.1",
|
|
54
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.36.1",
|
|
55
|
+
"@opentelemetry/resources": "^1.10.1",
|
|
56
|
+
"@opentelemetry/sdk-trace-base": "^1.10.1",
|
|
57
|
+
"@opentelemetry/sdk-trace-node": "^1.10.1",
|
|
58
|
+
"@opentelemetry/semantic-conventions": "^1.10.1"
|
|
59
|
+
},
|
|
60
|
+
"packageManager": "pnpm@7.24.0",
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=16"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc"
|
|
56
66
|
}
|
|
57
|
-
}
|
|
67
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
name: Tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
tags:
|
|
8
|
-
- "!*"
|
|
9
|
-
pull_request:
|
|
10
|
-
|
|
11
|
-
env:
|
|
12
|
-
NODE_VERSION: "16"
|
|
13
|
-
TURBO_REMOTE_ONLY: "true"
|
|
14
|
-
TURBO_TEAM: "vercel"
|
|
15
|
-
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
16
|
-
|
|
17
|
-
concurrency:
|
|
18
|
-
group: ${{ github.workflow }}-${{ github.ref }}
|
|
19
|
-
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
20
|
-
|
|
21
|
-
jobs:
|
|
22
|
-
build:
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v3
|
|
26
|
-
with:
|
|
27
|
-
fetch-depth: 2
|
|
28
|
-
- uses: actions/setup-node@v3
|
|
29
|
-
with:
|
|
30
|
-
node-version: ${{ env.NODE_VERSION }}
|
|
31
|
-
- run: npm i -g pnpm@7.24.2
|
|
32
|
-
- run: pnpm install
|
|
33
|
-
- run: pnpm build
|
package/src/index.edge.ts
DELETED
package/src/index.node.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export * from "@opentelemetry/api";
|
|
2
|
-
|
|
3
|
-
import { Resource } from "@opentelemetry/resources";
|
|
4
|
-
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
5
|
-
import {
|
|
6
|
-
NodeTracerProvider,
|
|
7
|
-
SimpleSpanProcessor,
|
|
8
|
-
} from "@opentelemetry/sdk-trace-node";
|
|
9
|
-
|
|
10
|
-
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
11
|
-
|
|
12
|
-
export const registerOTel = (serviceName: string) => {
|
|
13
|
-
const provider = new NodeTracerProvider({
|
|
14
|
-
resource: new Resource({
|
|
15
|
-
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
16
|
-
}),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
provider.register();
|
|
20
|
-
|
|
21
|
-
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({})));
|
|
22
|
-
|
|
23
|
-
return provider;
|
|
24
|
-
};
|
package/tsconfig.browser.json
DELETED
package/tsconfig.edge.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"declaration": true,
|
|
4
|
-
"declarationMap": true,
|
|
5
|
-
"esModuleInterop": true,
|
|
6
|
-
"lib": ["ES2020"],
|
|
7
|
-
"module": "commonjs",
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"noEmitOnError": true,
|
|
10
|
-
"noFallthroughCasesInSwitch": true,
|
|
11
|
-
"noImplicitReturns": true,
|
|
12
|
-
"noUnusedLocals": true,
|
|
13
|
-
"noUnusedParameters": true,
|
|
14
|
-
"outDir": "./dist",
|
|
15
|
-
"types": ["node"],
|
|
16
|
-
"strict": true,
|
|
17
|
-
"sourceMap": true,
|
|
18
|
-
"target": "ES2020"
|
|
19
|
-
},
|
|
20
|
-
"include": ["src/**/*"],
|
|
21
|
-
"exclude": ["node_modules"]
|
|
22
|
-
}
|
package/tsconfig.node.json
DELETED