@vercel/otel 0.0.17 โ 0.1.0
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 -1
- package/dist/index.node.d.ts +1 -2
- package/dist/index.node.js +6 -6
- package/dist/index.node.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install vercel/otel
|
|
|
17
17
|
## ๐ Usage
|
|
18
18
|
|
|
19
19
|
```javascript
|
|
20
|
-
import { registerOTel } from "vercel/otel";
|
|
20
|
+
import { registerOTel } from "@vercel/otel";
|
|
21
21
|
import { trace } from "@opentelemetry/api";
|
|
22
22
|
|
|
23
23
|
// Register the OpenTelemetry provider with an HTTP exporter
|
|
@@ -36,6 +36,12 @@ This is all that is needed to trace your app on Vercel.
|
|
|
36
36
|
|
|
37
37
|
- `serviceName`: The name of your service, used as the app name in many OpenTelemetry backends.
|
|
38
38
|
|
|
39
|
+
## ๐งช What exactly is this package doing
|
|
40
|
+
|
|
41
|
+
This package utilizes the [`exports`](https://nodejs.org/api/packages.html#exports) API, enabling us to import the OpenTelemetry SDK in Node only. When you import `registerOTel` in a file intended for the edge, it returns an empty function because OpenTelemetry doesn't support the edge. However, if you import the same function in a file designed for Node, you'll receive a standard function that sets up the OpenTelemetry SDK correctly.
|
|
42
|
+
|
|
43
|
+
The OpenTelemetry SDK initialization itself is straightforward. For more details, please see [the code](https://github.com/vercel/otel/blob/main/src/index.node.ts).
|
|
44
|
+
|
|
39
45
|
## ๐ License
|
|
40
46
|
|
|
41
47
|
[MIT](LICENSE)
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const registerOTel: (serviceName: string) => NodeTracerProvider;
|
|
1
|
+
export declare const registerOTel: (serviceName: string) => void;
|
package/dist/index.node.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
2
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
1
3
|
import { Resource } from "@opentelemetry/resources";
|
|
2
4
|
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
3
|
-
import {
|
|
4
|
-
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
5
|
+
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node";
|
|
5
6
|
export const registerOTel = (serviceName) => {
|
|
6
|
-
const
|
|
7
|
+
const sdk = new NodeSDK({
|
|
7
8
|
resource: new Resource({
|
|
8
9
|
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
9
10
|
}),
|
|
11
|
+
spanProcessor: new SimpleSpanProcessor(new OTLPTraceExporter()),
|
|
10
12
|
});
|
|
11
|
-
|
|
12
|
-
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({})));
|
|
13
|
-
return provider;
|
|
13
|
+
sdk.start();
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=index.node.js.map
|
package/dist/index.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.js","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.node.js","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAE,EAAE;IAClD,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC;QACtB,QAAQ,EAAE,IAAI,QAAQ,CAAC;YACrB,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,WAAW;SACvD,CAAC;QACF,aAAa,EAAE,IAAI,mBAAmB,CAAC,IAAI,iBAAiB,EAAE,CAAC;KAChE,CAAC,CAAC;IACH,GAAG,CAAC,KAAK,EAAE,CAAC;AACd,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/otel",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Vercel wrapper around OpenTelemetry APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "14.18.33",
|
|
50
|
-
"typescript": "^4.
|
|
50
|
+
"typescript": "^4.9.5"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"@opentelemetry/api": "^1.3.0",
|
|
53
54
|
"@opentelemetry/exporter-trace-otlp-http": "^0.36.1",
|
|
54
|
-
"@opentelemetry/resources": "^1.
|
|
55
|
-
"@opentelemetry/sdk-
|
|
56
|
-
"@opentelemetry/sdk-trace-node": "^1.
|
|
57
|
-
"@opentelemetry/semantic-conventions": "^1.
|
|
58
|
-
"@opentelemetry/api": "^1.1.0"
|
|
55
|
+
"@opentelemetry/resources": "^1.12.0",
|
|
56
|
+
"@opentelemetry/sdk-node": "^0.38.0",
|
|
57
|
+
"@opentelemetry/sdk-trace-node": "^1.12.0",
|
|
58
|
+
"@opentelemetry/semantic-conventions": "^1.12.0"
|
|
59
59
|
},
|
|
60
60
|
"packageManager": "pnpm@7.24.0",
|
|
61
61
|
"engines": {
|