Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sdk/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("defaultLoggerAdapter", () => {
expect(logSpy).toHaveBeenCalledOnce();
const arg = logSpy.mock.calls[0]?.[0] as string;
const parsed = JSON.parse(arg);
expect(parsed).toMatchObject({ level: "info", msg: "hello", foo: 1 });
expect(parsed).toMatchObject({ level: "INFO", msg: "hello", foo: 1 });
expect(typeof parsed.timestamp).toBe("string");
});

Expand Down
2 changes: 1 addition & 1 deletion src/sdk/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface LoggerAdapter {
export const defaultLoggerAdapter: LoggerAdapter = {
log(level, msg, attrs) {
const payload: Record<string, unknown> = {
level,
level: level.toUpperCase(),
msg,
timestamp: new Date().toISOString(),
};
Expand Down
4 changes: 2 additions & 2 deletions src/sdk/otel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ describe("instrumentWorker — OTLP/HTTP error-log channel wiring", () => {
}>;
};
const rec = payload.resourceLogs[0].scopeLogs[0].logRecords[0];
expect(rec.severityText).toBe("error");
expect(rec.severityText).toBe("ERROR");
expect(rec.body.stringValue).toBe("payment failed");
});

Expand Down Expand Up @@ -498,7 +498,7 @@ describe("instrumentWorker — OTLP/HTTP error-log channel wiring", () => {
const payload = JSON.parse(calls[0].body) as {
resourceLogs: Array<{ scopeLogs: Array<{ logRecords: Array<{ severityText: string }> }> }>;
};
expect(payload.resourceLogs[0].scopeLogs[0].logRecords[0].severityText).toBe("info");
expect(payload.resourceLogs[0].scopeLogs[0].logRecords[0].severityText).toBe("INFO");
});

it("otlpLogsEnabled=false disables the channel even when env is set", async () => {
Expand Down
8 changes: 4 additions & 4 deletions src/sdk/otel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ function bootObservability(opts: OtelOptions, env: Record<string, unknown>): voi
try {
warnDirect(
JSON.stringify({
level: "warn",
level: "WARN",
msg: "otlp error-log exporter",
kind,
error: err instanceof Error ? err.message : String(err),
Expand Down Expand Up @@ -819,7 +819,7 @@ function bootObservability(opts: OtelOptions, env: Record<string, unknown>): voi
try {
warnDirect(
JSON.stringify({
level: "warn",
level: "WARN",
msg: "otlp metrics exporter",
kind,
error: err instanceof Error ? err.message : String(err),
Expand Down Expand Up @@ -891,7 +891,7 @@ function bootObservability(opts: OtelOptions, env: Record<string, unknown>): voi
try {
warnDirect(
JSON.stringify({
level: "warn",
level: "WARN",
msg: "otlp traces exporter",
kind,
error: err instanceof Error ? err.message : String(err),
Expand Down Expand Up @@ -928,7 +928,7 @@ function bootObservability(opts: OtelOptions, env: Record<string, unknown>): voi
try {
warnDirect(
JSON.stringify({
level: "info",
level: "INFO",
msg: "observability booted",
service: serviceName,
analyticsEngine: aeEnabled,
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/otelHttpLog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("createOtlpHttpLogAdapter — level filter + OTLP shape", () => {
expect(calls).toHaveLength(1);
const p = JSON.parse(String(calls[0].init.body)) as OtlpLogsPayload;
const r = p.resourceLogs[0].scopeLogs[0].logRecords[0];
expect(r.severityText).toBe("error");
expect(r.severityText).toBe("ERROR");
expect(r.severityNumber).toBe(17);
expect(r.body.stringValue).toBe("boom");
expect(r.attributes).toContainEqual({
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/otelHttpLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export function createOtlpHttpLogAdapter(options: OtlpHttpLogOptions): OtlpHttpL
timeUnixNano: t,
observedTimeUnixNano: t,
severityNumber: SEVERITY_NUMBER[level],
severityText: level,
severityText: level.toUpperCase(),
body: msg,
attributes: attrs ? { ...attrs } : {},
traceId: spanCtx?.traceId ?? "",
Expand Down