From b98ee65554732fa012a5283159e3c861b2280302 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 4 Apr 2024 10:50:37 +0200 Subject: [PATCH 1/2] feat(sdk-trace-base): log resoruce attributes in ConsoleSpanExporter --- .../src/export/ConsoleSpanExporter.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts b/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts index 596b3cefd3..dcca6d23bf 100644 --- a/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts +++ b/packages/opentelemetry-sdk-trace-base/src/export/ConsoleSpanExporter.ts @@ -62,6 +62,9 @@ export class ConsoleSpanExporter implements SpanExporter { */ private _exportInfo(span: ReadableSpan) { return { + resource: { + attributes: span.resource.attributes, + }, traceId: span.spanContext().traceId, parentId: span.parentSpanId, traceState: span.spanContext().traceState?.serialize(), From d796d894fc918c4100d3b2eb084ae22cd904d24e Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 4 Apr 2024 11:27:21 +0200 Subject: [PATCH 2/2] fixup! feat(sdk-trace-base): log resoruce attributes in ConsoleSpanExporter --- CHANGELOG.md | 2 ++ .../test/common/export/ConsoleSpanExporter.test.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f966b0bea..404c5f33b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :rocket: (Enhancement) +feat(sdk-trace-base): log resource attributes in ConsoleSpanExporter [#4605](https://github.com/open-telemetry/opentelemetry-js/pull/4605) @pichlermarc + ### :bug: (Bug Fix) ### :books: (Refine Doc) diff --git a/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts index d005a2f803..ab50d26b57 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/export/ConsoleSpanExporter.test.ts @@ -84,6 +84,7 @@ describe('ConsoleSpanExporter', () => { 'links', 'name', 'parentId', + 'resource', 'status', 'timestamp', 'traceId',