Skip to content

Commit

Permalink
Merge branch 'feat/DEX-2551/write-otel-trace_id-to-outgoing-message-l…
Browse files Browse the repository at this point in the history
…ogs' into 'master'

[DEX-2551] feat: write otel trace_id to outgoing message logs

Closes DEX-2551

See merge request nstmrt/rubygems/sbmt-kafka_consumer!69
  • Loading branch information
Arlantir committed Sep 25, 2024
2 parents 7c432c6 + ed2b4b0 commit 6ac0f65
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

## [3.2.2] - 2024-09-23

### Fixed

- log OTEL `trace_id`

## [3.2.1] - 2024-09-20

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion lib/sbmt/kafka_consumer/base_consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ def call_middlewares(message, middlewares)
end

def trace_id
@trace_id ||= SecureRandom.base58
return nil unless defined?(::OpenTelemetry)

context = ::OpenTelemetry::Trace.current_span.context

context.valid? ? context.hex_trace_id : nil
end

def config
Expand Down
2 changes: 1 addition & 1 deletion lib/sbmt/kafka_consumer/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Sbmt
module KafkaConsumer
VERSION = "3.2.1"
VERSION = "3.2.2"
end
end

0 comments on commit 6ac0f65

Please sign in to comment.