Sha256: 8f1d6527652c888b11bf17b785bc689f809b332ed3e0770b71edb0e357a23ed5
Contents?: true
Size: 972 Bytes
Versions: 2
Compression:
Stored size: 972 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.text.inject(headers) super end end private def tracer RubyKafka::Instrumentation.instance.tracer end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems