lib/opentelemetry/exporters/datadog/exporter.rb in opentelemetry-exporters-datadog-0.1.0 vs lib/opentelemetry/exporters/datadog/exporter.rb in opentelemetry-exporters-datadog-0.2.0
- old
+ new
@@ -5,13 +5,12 @@
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2020 Datadog, Inc.
require 'uri'
require 'ddtrace'
-require 'opentelemetry/sdk'
+require 'opentelemetry'
require 'opentelemetry/exporters/datadog/exporter/span_encoder'
-# require_relative './exporter/span_encoder.rb'
module OpenTelemetry
module Exporters
module Datadog
# SpanExporter allows different tracing services to export
@@ -20,20 +19,12 @@
# To export data an exporter MUST be registered to the {TracerProvider} using
# a {DatadogSpanProcessorr}.
class Exporter
DEFAULT_AGENT_URL = 'http://localhost:8126'
DEFAULT_SERVICE_NAME = 'my_service'
- SUCCESS = begin
- OpenTelemetry::SDK::Trace::Export::SUCCESS
- rescue NameError
- 0
- end
- FAILURE = begin
- OpenTelemetry::SDK::Trace::Export::FAILURE
- rescue NameError
- 1
- end
+ SUCCESS = 0
+ FAILURE = 1
private_constant(:SUCCESS, :FAILURE)
def initialize(service_name: nil, agent_url: nil, env: nil, version: nil, tags: nil)
@shutdown = false
@agent_url = agent_url || ENV.fetch('DD_TRACE_AGENT_URL', DEFAULT_AGENT_URL)
@@ -66,10 +57,10 @@
end
end
# Called when {TracerProvider#shutdown} is called, if this exporter is
# registered to a {TracerProvider} object.
- def shutdown
+ def shutdown(timeout: nil)
@shutdown = true
end
private