@neutrome/open-ai-router 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neutrome/open-ai-router",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
@@ -8,8 +8,8 @@
8
8
  "dependencies": {
9
9
  "@modelcontextprotocol/sdk": "^1.29.0",
10
10
  "hono": "^4.12.18",
11
- "@neutrome/lil-engine": "0.3.0",
12
- "@neutrome/lilsdk-ts": "0.3.0"
11
+ "@neutrome/lil-engine": "0.3.1",
12
+ "@neutrome/lilsdk-ts": "0.3.1"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/node": "^25.9.3",
package/src/otlp.ts CHANGED
@@ -24,7 +24,7 @@ export async function exportOtlp(
24
24
  const endpoint = endpointFor(env, signal);
25
25
  if (!endpoint) return;
26
26
  try {
27
- await fetch(endpoint, {
27
+ const response = await fetch(endpoint, {
28
28
  method: "POST",
29
29
  headers: {
30
30
  "content-type": "application/json",
@@ -46,6 +46,13 @@ export async function exportOtlp(
46
46
  ],
47
47
  }),
48
48
  });
49
+ if (!response.ok) {
50
+ console.error("[telemetry] OTLP export rejected", {
51
+ signal,
52
+ status: response.status,
53
+ statusText: response.statusText,
54
+ });
55
+ }
49
56
  } catch (error) {
50
57
  console.error("[telemetry] OTLP export failed", error);
51
58
  }
@@ -47,4 +47,32 @@ describe("createRouterTelemetry", () => {
47
47
  });
48
48
  fetchMock.mockRestore();
49
49
  });
50
+
51
+ it("logs a rejected exporter response without exposing credentials", async () => {
52
+ const fetchMock = vi
53
+ .spyOn(globalThis, "fetch")
54
+ .mockResolvedValue(
55
+ new Response(null, { status: 401, statusText: "Unauthorized" }),
56
+ );
57
+ const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
58
+ const telemetry = createRouterTelemetry({
59
+ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "https://traces.example/v1/traces",
60
+ OTEL_EXPORTER_OTLP_TRACES_HEADERS: "authorization=Bearer%20trace-token",
61
+ });
62
+ telemetry.recordError({
63
+ message: "request failed",
64
+ requestId: "request-1",
65
+ executionId: "execution-1",
66
+ });
67
+
68
+ await telemetry.flush();
69
+
70
+ expect(errorSpy).toHaveBeenCalledWith("[telemetry] OTLP export rejected", {
71
+ signal: "traces",
72
+ status: 401,
73
+ statusText: "Unauthorized",
74
+ });
75
+ fetchMock.mockRestore();
76
+ errorSpy.mockRestore();
77
+ });
50
78
  });