Skip to content

Commit

Permalink
feat(sdk-logs): emit resource attributes from ConsoleLogRecordExporter (
Browse files Browse the repository at this point in the history
#4646)

* feat(sdk-logs): emit resource attributes from ConsoleLogRecordExporter

* Update CHANGELOG

* Fix test

* Update experimental CHANGELOG

---------

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
  • Loading branch information
harelmo-lumigo and pichlermarc authored Apr 26, 2024
1 parent 8c12dd5 commit e44895f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ All notable changes to experimental packages in this project will be documented

### :rocket: (Enhancement)

* feat(sdk-logs): log resource attributes in ConsoleLogRecordExporter [#4646](https://github.com/open-telemetry/opentelemetry-js/pull/4646) @harelmo-lumigo
* refactor(instrumentation-grpc): move to use SEMATTRS [#4633](https://github.com/open-telemetry/opentelemetry-js/pull/4633)
* feat(otlp-transformer): consolidate scope/resource creation in transformer [#4600](https://github.com/open-telemetry/opentelemetry-js/pull/4600)
* feat(sdk-logs): print message when attributes are dropped due to attribute count limit [#4614](https://github.com/open-telemetry/opentelemetry-js/pull/4614) @HyunnoH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export class ConsoleLogRecordExporter implements LogRecordExporter {
*/
private _exportInfo(logRecord: ReadableLogRecord) {
return {
resource: {
attributes: logRecord.resource.attributes,
},
timestamp: hrTimeToMicroseconds(logRecord.hrTime),
traceId: logRecord.spanContext?.traceId,
spanId: logRecord.spanContext?.spanId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe('ConsoleLogRecordExporter', () => {
const expectedKeys = [
'attributes',
'body',
'resource',
'severityNumber',
'severityText',
'spanId',
Expand Down

0 comments on commit e44895f

Please sign in to comment.