Skip to content

Commit

Permalink
[DEX-2551] feat: write otel trace_id to outgoing message logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlantir committed Sep 25, 2024
1 parent 7c432c6 commit ed2b4b0
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 ed2b4b0

Please sign in to comment.