Sha256: 814f8785946421da95a61c4c671c3343bb0a8ab027155be79cd7bfa4a55c7df6
Contents?: true
Size: 1.62 KB
Versions: 13
Compression:
Stored size: 1.62 KB
Contents
# frozen_string_literal: true require_relative 'component' require_relative 'grpc/integration' require_relative 'grpc/distributed/propagation' module Datadog module Tracing module Contrib # `gRPC` integration public API # @public_api module GRPC # Inject distributed headers into the given request # @param digest [Datadog::Tracing::TraceDigest] the trace to inject # @param data [Hash] the request to inject def self.inject(digest, data) raise 'Please invoke Datadog.configure at least once before calling this method' unless @propagation @propagation.inject!(digest, data) end # Extract distributed headers from the given request # @param data [Hash] the request to extract from # @return [Datadog::Tracing::TraceDigest,nil] the extracted trace digest or nil if none was found def self.extract(data) raise 'Please invoke Datadog.configure at least once before calling this method' unless @propagation @propagation.extract(data) end Contrib::Component.register('grpc') do |config| tracing = config.tracing # DEV: evaluate propagation_style in case it overrides propagation_style_extract & propagation_extract_first tracing.propagation_style @propagation = GRPC::Distributed::Propagation.new( propagation_style_inject: tracing.propagation_style_inject, propagation_style_extract: tracing.propagation_style_extract, propagation_extract_first: tracing.propagation_extract_first ) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems