@devopsplaybook.io/otel-utils-fastify 1.1.0-beta.26.afe4f4a → 1.1.1-beta.27.0d6de79
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/eslint.config.mjs +2 -1
- package/jest.config.js +1 -0
- package/package.json +10 -8
- package/src/StandardTracerFastify.spec.ts +8 -6
package/eslint.config.mjs
CHANGED
|
@@ -4,7 +4,8 @@ import eslint from "@eslint/js";
|
|
|
4
4
|
import tseslint from "typescript-eslint";
|
|
5
5
|
|
|
6
6
|
export default tseslint.config(
|
|
7
|
+
{ ignores: ["dist/", "node_modules/"] },
|
|
7
8
|
eslint.configs.recommended,
|
|
8
9
|
...tseslint.configs.strict,
|
|
9
|
-
...tseslint.configs.stylistic
|
|
10
|
+
...tseslint.configs.stylistic,
|
|
10
11
|
);
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devopsplaybook.io/otel-utils-fastify",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1-beta.27.0d6de79",
|
|
4
4
|
"description": "Utility to simplify integration with Open Telemetry for Fastify API Server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Open Telemetry",
|
|
@@ -16,25 +16,27 @@
|
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc",
|
|
19
|
-
"
|
|
19
|
+
"lint": "eslint src",
|
|
20
|
+
"test": "jest --coverage"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@devopsplaybook.io/otel-utils": "^1.1.
|
|
23
|
+
"@devopsplaybook.io/otel-utils": "^1.1.1",
|
|
23
24
|
"@opentelemetry/api": "^1.9.1",
|
|
24
|
-
"@opentelemetry/core": "^2.
|
|
25
|
-
"@opentelemetry/sdk-trace-base": "^2.
|
|
25
|
+
"@opentelemetry/core": "^2.8.0",
|
|
26
|
+
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
26
27
|
"@opentelemetry/semantic-conventions": "^1.41.1",
|
|
27
28
|
"fastify": "^5.8.5"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@eslint/js": "^10.0.1",
|
|
31
32
|
"@types/jest": "^30.0.0",
|
|
32
|
-
"@types/node": "^
|
|
33
|
+
"@types/node": "^26.0.1",
|
|
34
|
+
"eslint": "^10.5.0",
|
|
33
35
|
"jest": "^30.4.2",
|
|
34
36
|
"ts-jest": "^29.4.11",
|
|
35
37
|
"ts-node": "^10.9.2",
|
|
36
|
-
"typescript
|
|
37
|
-
"typescript": "^
|
|
38
|
+
"typescript": "^6.0.3",
|
|
39
|
+
"typescript-eslint": "^8.62.0"
|
|
38
40
|
},
|
|
39
41
|
"publishConfig": {
|
|
40
42
|
"access": "public"
|
|
@@ -40,11 +40,11 @@ function buildApp(options?: StandardTracerFastifyRegisterHooksOptions) {
|
|
|
40
40
|
|
|
41
41
|
const app = Fastify();
|
|
42
42
|
|
|
43
|
-
app.get("/api/test", async (
|
|
43
|
+
app.get("/api/test", async () => ({ ok: true }));
|
|
44
44
|
app.get("/api/status", async (_req, res) =>
|
|
45
45
|
res.status(400).send({ error: "bad" }),
|
|
46
46
|
);
|
|
47
|
-
app.get("/api/error-test", async (
|
|
47
|
+
app.get("/api/error-test", async () => {
|
|
48
48
|
throw new Error("test error");
|
|
49
49
|
});
|
|
50
50
|
app.get("/api/echo", async (req, res) => {
|
|
@@ -55,13 +55,15 @@ function buildApp(options?: StandardTracerFastifyRegisterHooksOptions) {
|
|
|
55
55
|
const span = OTelRequestSpan(req);
|
|
56
56
|
return res.send({ hasSpan: !!span });
|
|
57
57
|
});
|
|
58
|
-
app.get("/api/pub/health", async (
|
|
59
|
-
app.get("/api/pub/metrics", async (
|
|
60
|
-
app.get("/api/health", async (
|
|
58
|
+
app.get("/api/pub/health", async () => ({ ok: true }));
|
|
59
|
+
app.get("/api/pub/metrics", async () => ({ ok: true }));
|
|
60
|
+
app.get("/api/health", async () => ({ ok: true }));
|
|
61
61
|
|
|
62
62
|
StandardTracerFastifyRegisterHooks(
|
|
63
63
|
app,
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
65
|
mockTracer as any,
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
67
|
mockLogger as any,
|
|
66
68
|
options,
|
|
67
69
|
);
|
|
@@ -92,7 +94,7 @@ describe("request filtering", () => {
|
|
|
92
94
|
|
|
93
95
|
test("traces requests inside rootApiPath", async () => {
|
|
94
96
|
const { app, mockTracer } = buildApp({ rootApiPath: "/api/v2" });
|
|
95
|
-
app.get("/api/v2/data", async (
|
|
97
|
+
app.get("/api/v2/data", async () => ({ ok: true }));
|
|
96
98
|
await app.inject({ method: "GET", url: "/api/v2/data" });
|
|
97
99
|
expect(mockTracer.startSpan).toHaveBeenCalledWith("GET-/api/v2/data");
|
|
98
100
|
});
|