Sha256: 8d8b496c6fb836fcf121c5d6f4c428b3edba117de7a7ef7c033cddb778279523
Contents?: true
Size: 995 Bytes
Versions: 8
Compression:
Stored size: 995 Bytes
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module Rdkafka module Patches # The Producer module contains the instrumentation patch the Producer#produce method module Producer def produce(topic:, payload: nil, key: nil, partition: nil, partition_key: nil, timestamp: nil, headers: nil) attributes = { 'messaging.system' => 'kafka', 'messaging.destination' => topic, 'messaging.destination_kind' => 'topic' } headers ||= {} tracer.in_span("#{topic} publish", attributes: attributes, kind: :producer) do OpenTelemetry.propagation.inject(headers) super end end private def tracer Rdkafka::Instrumentation.instance.tracer end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems