Skip to content

Add BaggageLogProcessor to opentelemetry-processor-baggage#4371

Open
Manvi2402 wants to merge 1 commit intoopen-telemetry:mainfrom
Manvi2402:add-baggage-log-processor
Open

Add BaggageLogProcessor to opentelemetry-processor-baggage#4371
Manvi2402 wants to merge 1 commit intoopen-telemetry:mainfrom
Manvi2402:add-baggage-log-processor

Conversation

@Manvi2402
Copy link
Copy Markdown

Description

Adds BaggageLogProcessor which reads entries stored in Baggage from the current context and adds the baggage entries' keys and values to the log record as attributes on emit.

This is analogous to the existing BaggageSpanProcessor but for logs.

Fixes #4062

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [ x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ x ] This change requires a documentation update

How Has This Been Tested?

Added unit tests in test_baggage_log_processor.py:

  • test_check_the_baggage - verifies BaggageLogProcessor is instance of LogRecordProcessor
  • test_baggage_added_to_log_record - verifies baggage is added to log attributes
  • test_baggage_with_prefix - verifies predicate filtering with string prefix
  • test_baggage_with_regex - verifies predicate filtering with regex
  • test_no_baggage_not_added - verifies no baggage keys added when baggage is empty

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • [ x ] No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • [ x] Followed the style guidelines of this project
  • [ x] Changelogs have been updated
  • [ x] Unit tests have been added
  • [ x] Documentation has been updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add baggage attributes to log records

1 participant