@vercel/otel 0.0.2 → 0.0.17
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 +9 -22
- 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 -2
- package/dist/index.node.js +9 -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
|
@@ -1,20 +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
|
-
[](https://www.npmjs.com/package/@vercel/otel)
|
|
16
4
|
|
|
17
|
-
|
|
5
|
+
> **Note:** This package is experimental. Updates can contain breaking changes.
|
|
6
|
+
|
|
7
|
+
`vercel/otel` is a simple and easy-to-use package that sets up your trace provider and exporter.
|
|
18
8
|
|
|
19
9
|
💡 Use this package to quickly instrument your applications and get started with OpenTelemetry!
|
|
20
10
|
|
|
@@ -27,10 +17,11 @@ npm install vercel/otel
|
|
|
27
17
|
## 📚 Usage
|
|
28
18
|
|
|
29
19
|
```javascript
|
|
30
|
-
|
|
20
|
+
import { registerOTel } from "vercel/otel";
|
|
21
|
+
import { trace } from "@opentelemetry/api";
|
|
31
22
|
|
|
32
23
|
// Register the OpenTelemetry provider with an HTTP exporter
|
|
33
|
-
|
|
24
|
+
registerOTel("your-service-name");
|
|
34
25
|
|
|
35
26
|
// Now you can use the OpenTelemetry APIs
|
|
36
27
|
const span = trace.getTracer("your-component").startSpan("your-operation");
|
|
@@ -38,21 +29,17 @@ const span = trace.getTracer("your-component").startSpan("your-operation");
|
|
|
38
29
|
|
|
39
30
|
## 📖 API Reference
|
|
40
31
|
|
|
41
|
-
### `
|
|
32
|
+
### `registerOTel(serviceName: string)`
|
|
42
33
|
|
|
43
34
|
Registers the OpenTelemetry provider with an HTTP exporter using the given service name.
|
|
44
35
|
This is all that is needed to trace your app on Vercel.
|
|
45
36
|
|
|
46
37
|
- `serviceName`: The name of your service, used as the app name in many OpenTelemetry backends.
|
|
47
38
|
|
|
48
|
-
### Re-exported APIs
|
|
49
|
-
|
|
50
|
-
This package re-exports everything from `@opentelemetry/api`. Refer to the official [OpenTelemetry API documentation](https://opentelemetry.io/docs/instrumentation/js/) for details on how to use these APIs.
|
|
51
|
-
|
|
52
39
|
## 📄 License
|
|
53
40
|
|
|
54
41
|
[MIT](LICENSE)
|
|
55
42
|
|
|
56
43
|
---
|
|
57
44
|
|
|
58
|
-
Made with 💖 by
|
|
45
|
+
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,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
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
|
+
import { Resource } from "@opentelemetry/resources";
|
|
2
|
+
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
3
|
+
import { NodeTracerProvider, SimpleSpanProcessor, } from "@opentelemetry/sdk-trace-node";
|
|
4
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
5
|
+
export const registerOTel = (serviceName) => {
|
|
6
|
+
const provider = new NodeTracerProvider({
|
|
7
|
+
resource: new Resource({
|
|
8
|
+
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
27
9
|
}),
|
|
28
10
|
});
|
|
29
11
|
provider.register();
|
|
30
|
-
provider.addSpanProcessor(new
|
|
12
|
+
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({})));
|
|
31
13
|
return provider;
|
|
32
14
|
};
|
|
33
|
-
exports.registerOTel = registerOTel;
|
|
34
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":"
|
|
1
|
+
{"version":3,"file":"index.node.js","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA,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.17",
|
|
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/
|
|
55
|
-
"@opentelemetry/
|
|
56
|
-
"@opentelemetry/
|
|
57
|
-
"@opentelemetry/sdk-trace-node": "1.
|
|
58
|
-
"@opentelemetry/semantic-conventions": "1.
|
|
53
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.36.1",
|
|
54
|
+
"@opentelemetry/resources": "^1.10.1",
|
|
55
|
+
"@opentelemetry/sdk-trace-base": "^1.10.1",
|
|
56
|
+
"@opentelemetry/sdk-trace-node": "^1.10.1",
|
|
57
|
+
"@opentelemetry/semantic-conventions": "^1.10.1",
|
|
58
|
+
"@opentelemetry/api": "^1.1.0"
|
|
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"}
|