Sha256: 2fd172f84507d34df5452f359eca404f97db256b0d824666a92889e1fcc34116

Contents?: true

Size: 1.78 KB

Versions: 17

Compression:

Stored size: 1.78 KB

Contents

# frozen_string_literal: true

# Entrypoint file for OpenTelemetry integration.
#
# This file's path is part of the @public_api.
#
# OpenTelemetry includes metrics, tracing, logs, and profiling.
# This file activates the integrations of all OpenTelemetry
# components supported by Datadog.

# Load Tracing
require_relative 'tracing'
require_relative 'tracing/contrib'

require_relative 'opentelemetry/api/context'

# DEV: Should this be a Contrib integration, that depends on the `opentelemetry-sdk`
# DEV: and checks for compatibility?
# DEV: This is different from our existing OpenTracer API, but there are many safety
# DEV: features built into Contrib instrumentation today.
require_relative 'opentelemetry/sdk/configurator' if defined?(OpenTelemetry::SDK)
require_relative 'opentelemetry/sdk/trace/span' if defined?(OpenTelemetry::SDK)

module Datadog
  # Datadog OpenTelemetry integration.
  module OpenTelemetry
    # Used by Telemetry to decide if OpenTelemetry instrumentation is enabled
    LOADED = true

    # Use `Datadog.logger` as the default logger
    def logger
      @logger ||= ::Datadog.logger
    end

    ::OpenTelemetry.singleton_class.prepend(self)
  end
end

# OpenTelemetry does not wait until the "root" span is finished to flush:
# the "root" span does not have special influence on flushing order.
#
# The "root" OpenTelemetry span might be a span that is never finished, but
# instead a placeholder for distributed tracing information, and ultimately gets discarded.
# Consumers of the OpenTelemetry SpanProcessor pipeline are free to flush spans whenever
# an individual span is finished.
# Currently, this closely translates to Datadog's partial flushing.
#
# @see OpenTelemetry::SDK::Trace::SpanProcessor#on_finish
Datadog.configure do |c|
  c.tracing.partial_flush.enabled = true
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
datadog-2.7.0 lib/datadog/opentelemetry.rb
datadog-2.6.0 lib/datadog/opentelemetry.rb
datadog-2.5.0 lib/datadog/opentelemetry.rb
datadog-2.4.0 lib/datadog/opentelemetry.rb
datadog-2.3.0 lib/datadog/opentelemetry.rb
datadog-2.2.0 lib/datadog/opentelemetry.rb
ddtrace-1.23.3 lib/datadog/opentelemetry.rb
ddtrace-1.23.2 lib/datadog/opentelemetry.rb
datadog-2.1.0 lib/datadog/opentelemetry.rb
datadog-2.0.0 lib/datadog/opentelemetry.rb
ddtrace-1.23.1 lib/datadog/opentelemetry.rb
datadog-2.0.0.beta2 lib/datadog/opentelemetry.rb
ddtrace-1.22.0 lib/datadog/opentelemetry.rb
datadog-2.0.0.beta1 lib/datadog/opentelemetry.rb
ddtrace-1.21.1 lib/datadog/opentelemetry.rb
ddtrace-1.21.0 lib/datadog/opentelemetry.rb
ddtrace-1.20.0 lib/datadog/opentelemetry.rb