@vercel/otel 0.0.15 โ 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 -16
- package/dist/index.node.d.ts +1 -3
- package/dist/index.node.js +6 -7
- package/dist/index.node.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
PROMPT for GPT-4:
|
|
3
|
-
Write me a README.md for package vercel/otel that helps people get started by setting up their exporter and trace provider for them and false bundles all OPen Telemetry apis in a single package.
|
|
4
|
-
It's not a powerful as using raw APIS, but It should be enough for most cases.
|
|
5
|
-
|
|
6
|
-
This package exports function `register()` that registers open telemetry provider with a HTTP exporter.
|
|
7
|
-
Register function takes one argument, it's string and it's a service name. It will be used as the app name in many OpenTelemetry backends.
|
|
8
|
-
This package also reexports `@opentelemetry/api` and `@opentelemetry/semantics`.
|
|
9
|
-
|
|
10
|
-
Use that hip style for Readme that many JS devs use. Keep it concise.
|
|
11
|
-
-->
|
|
12
|
-
|
|
13
1
|
# ๐ Vercel Otel
|
|
14
2
|
|
|
15
3
|
[](https://www.npmjs.com/package/@vercel/otel)
|
|
16
4
|
|
|
17
5
|
> **Note:** This package is experimental. Updates can contain breaking changes.
|
|
18
6
|
|
|
19
|
-
`vercel/otel` is a simple and easy-to-use package that sets up your trace provider and exporter
|
|
7
|
+
`vercel/otel` is a simple and easy-to-use package that sets up your trace provider and exporter.
|
|
20
8
|
|
|
21
9
|
๐ก Use this package to quickly instrument your applications and get started with OpenTelemetry!
|
|
22
10
|
|
|
@@ -29,7 +17,8 @@ npm install vercel/otel
|
|
|
29
17
|
## ๐ Usage
|
|
30
18
|
|
|
31
19
|
```javascript
|
|
32
|
-
|
|
20
|
+
import { registerOTel } from "@vercel/otel";
|
|
21
|
+
import { trace } from "@opentelemetry/api";
|
|
33
22
|
|
|
34
23
|
// Register the OpenTelemetry provider with an HTTP exporter
|
|
35
24
|
registerOTel("your-service-name");
|
|
@@ -47,9 +36,11 @@ This is all that is needed to trace your app on Vercel.
|
|
|
47
36
|
|
|
48
37
|
- `serviceName`: The name of your service, used as the app name in many OpenTelemetry backends.
|
|
49
38
|
|
|
50
|
-
|
|
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.
|
|
51
42
|
|
|
52
|
-
|
|
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).
|
|
53
44
|
|
|
54
45
|
## ๐ License
|
|
55
46
|
|
package/dist/index.node.d.ts
CHANGED
package/dist/index.node.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
2
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
2
3
|
import { Resource } from "@opentelemetry/resources";
|
|
3
4
|
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
4
|
-
import {
|
|
5
|
-
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
|
|
5
|
+
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node";
|
|
6
6
|
export const registerOTel = (serviceName) => {
|
|
7
|
-
const
|
|
7
|
+
const sdk = new NodeSDK({
|
|
8
8
|
resource: new Resource({
|
|
9
9
|
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
10
10
|
}),
|
|
11
|
+
spanProcessor: new SimpleSpanProcessor(new OTLPTraceExporter()),
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({})));
|
|
14
|
-
return provider;
|
|
13
|
+
sdk.start();
|
|
15
14
|
};
|
|
16
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,
|
|
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.
|
|
54
|
-
"@opentelemetry/exporter-trace-otlp-
|
|
55
|
-
"@opentelemetry/resources": "^1.
|
|
56
|
-
"@opentelemetry/sdk-
|
|
57
|
-
"@opentelemetry/sdk-trace-node": "^1.
|
|
58
|
-
"@opentelemetry/semantic-conventions": "^1.
|
|
53
|
+
"@opentelemetry/api": "^1.3.0",
|
|
54
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.36.1",
|
|
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": {
|