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