@vercel/otel 0.0.2 → 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 +0 -1
- package/dist/index.edge.js +2 -6
- package/dist/index.edge.js.map +1 -1
- package/dist/index.node.d.ts +0 -1
- package/dist/index.node.js +10 -28
- package/dist/index.node.js.map +1 -1
- package/package.json +25 -18
- package/dist/index.edge.d.ts.map +0 -1
- package/dist/index.node.d.ts.map +0 -1
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! 📈
|
package/dist/index.edge.d.ts
CHANGED
package/dist/index.edge.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.registerOTel = void 0;
|
|
4
|
-
const registerOTel = (serviceName) => {
|
|
1
|
+
export const registerOTel = (serviceName) => {
|
|
2
|
+
// We don't support OTel on edge yet
|
|
5
3
|
void serviceName;
|
|
6
|
-
// We don't support OpenTelemetry on edge.
|
|
7
4
|
};
|
|
8
|
-
exports.registerOTel = registerOTel;
|
|
9
5
|
//# sourceMappingURL=index.edge.js.map
|
package/dist/index.edge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.edge.js","sourceRoot":"","sources":["../src/index.edge.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/index.node.d.ts
CHANGED
package/dist/index.node.js
CHANGED
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.registerOTel = void 0;
|
|
18
|
-
__exportStar(require("@opentelemetry/api"), exports);
|
|
19
|
-
const resources_1 = require("@opentelemetry/resources");
|
|
20
|
-
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
21
|
-
const sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
|
|
22
|
-
const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
|
|
23
|
-
const registerOTel = (serviceName) => {
|
|
24
|
-
const provider = new sdk_trace_node_1.NodeTracerProvider({
|
|
25
|
-
resource: new resources_1.Resource({
|
|
26
|
-
[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
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,
|
|
27
10
|
}),
|
|
28
11
|
});
|
|
29
12
|
provider.register();
|
|
30
|
-
provider.addSpanProcessor(new
|
|
13
|
+
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({})));
|
|
31
14
|
return provider;
|
|
32
15
|
};
|
|
33
|
-
exports.registerOTel = registerOTel;
|
|
34
16
|
//# 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":"
|
|
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,11 +1,12 @@
|
|
|
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
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
|
+
"types": "./dist/index.node.d.ts",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"edge": {
|
|
@@ -16,6 +17,10 @@
|
|
|
16
17
|
"types": "./dist/index.edge.d.ts",
|
|
17
18
|
"default": "./dist/index.edge.js"
|
|
18
19
|
},
|
|
20
|
+
"browser": {
|
|
21
|
+
"types": "./dist/index.edge.d.ts",
|
|
22
|
+
"default": "./dist/index.edge.js"
|
|
23
|
+
},
|
|
19
24
|
"worker": {
|
|
20
25
|
"types": "./dist/index.edge.d.ts",
|
|
21
26
|
"default": "./dist/index.edge.js"
|
|
@@ -31,19 +36,13 @@
|
|
|
31
36
|
"node": {
|
|
32
37
|
"types": "./dist/index.node.d.ts",
|
|
33
38
|
"default": "./dist/index.node.js"
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
},
|
|
40
|
+
"default": "./dist/index.node.js"
|
|
41
|
+
}
|
|
37
42
|
},
|
|
38
43
|
"repository": {
|
|
39
44
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/vercel/
|
|
41
|
-
"directory": "packages/otel"
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "pnpm build:node && pnpm build:edge",
|
|
45
|
-
"build:node": "tsc --project tsconfig.node.json",
|
|
46
|
-
"build:edge": "tsc --project tsconfig.edge.json"
|
|
45
|
+
"url": "https://github.com/vercel/otel.git"
|
|
47
46
|
},
|
|
48
47
|
"license": "MIT",
|
|
49
48
|
"devDependencies": {
|
|
@@ -51,10 +50,18 @@
|
|
|
51
50
|
"typescript": "^4.8.4"
|
|
52
51
|
},
|
|
53
52
|
"dependencies": {
|
|
54
|
-
"@opentelemetry/api": "1.4.1",
|
|
55
|
-
"@opentelemetry/exporter-trace-otlp-
|
|
56
|
-
"@opentelemetry/resources": "1.
|
|
57
|
-
"@opentelemetry/sdk-trace-
|
|
58
|
-
"@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"
|
|
59
66
|
}
|
|
60
|
-
}
|
|
67
|
+
}
|
package/dist/index.edge.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.edge.d.ts","sourceRoot":"","sources":["../src/index.edge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,gBAAiB,MAAM,SAG/C,CAAC"}
|
package/dist/index.node.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAInC,OAAO,EACL,kBAAkB,EAEnB,MAAM,+BAA+B,CAAC;AAIvC,eAAO,MAAM,YAAY,gBAAiB,MAAM,uBAY/C,CAAC"}
|