Skip to content

[OpenTracing] Add OpenTracing configuration#464

Merged
delner merged 2 commits into
feature/opentracingfrom
feature/opentracing_configuration
Jun 18, 2018
Merged

[OpenTracing] Add OpenTracing configuration#464
delner merged 2 commits into
feature/opentracingfrom
feature/opentracing_configuration

Conversation

@delner

@delner delner commented Jun 14, 2018

Copy link
Copy Markdown
Contributor

This pull request allows users to configure the Datadog::OpenTracer::Tracer with configuration settings to get the most out of their tracer setup.

# Pass options to the constructor
# where options is a Hash of settings accepted by Datadog::Tracer#initialize
Datadog::OpenTracer::Tracer.new(options).tap do |tracer|
  # Be sure to set the global tracer
  OpenTracing.global_tracer = tracer

  # Get the underlying Datadog::Tracer
  tracer.datadog_tracer

  # Configure the tracer with additional options
  # where options is a Hash of settings accepted by Datadog::Tracer#configure
  tracer.configure(options)

  # Integrations and other settings should be activated using
  # the existing Datadog configuration API.
  Datadog.configure do |c|
    c.use :rails
  end
end

A more abbreviated, practical example might look like:

# Activate Datadog open tracer
OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new(options)

# Activate and configure integrations
Datadog.configure do |c|
  c.use :rails
end

@delner delner added core Involves Datadog core libraries feature Involves a product feature labels Jun 14, 2018
@delner delner self-assigned this Jun 14, 2018
@delner
delner force-pushed the feature/opentracing_configuration branch from 4e6e413 to 9a03595 Compare June 14, 2018 20:46
@delner
delner force-pushed the feature/opentracing_configuration branch from 9a03595 to a840034 Compare June 15, 2018 17:04

@Kyle-Verhoog Kyle-Verhoog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the one comment. 😄


def initialize(options = {})
super()
@datadog_tracer = Datadog::Tracer.new(options)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this configuration immutable? If options changes at run-time will we get undefined behaviour?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options Hash is not immutable. However, if you dig into the code, you'll see it doesn't store the Hash, but copies the values out of the hash and stores them in different variables. So it acts immutable, in that sense.

@delner
delner merged commit d731369 into feature/opentracing Jun 18, 2018
@delner
delner deleted the feature/opentracing_configuration branch June 20, 2018 18:19
delner added a commit that referenced this pull request Jun 22, 2018
* Added: Datadog::OpenTracer::Tracer#datadog_tracer.

* Added: Patch for OpenTracing#global_tracer=.
delner added a commit that referenced this pull request Jul 10, 2018
* Added: Datadog::OpenTracer::Tracer#datadog_tracer.

* Added: Patch for OpenTracing#global_tracer=.
delner added a commit that referenced this pull request Jul 16, 2018
* Added: Datadog::OpenTracer::Tracer#datadog_tracer.

* Added: Patch for OpenTracing#global_tracer=.
delner added a commit that referenced this pull request Jul 17, 2018
* Added: Datadog::OpenTracer::Tracer#datadog_tracer.

* Added: Patch for OpenTracing#global_tracer=.
delner added a commit that referenced this pull request Aug 9, 2018
* Added: Datadog::OpenTracer::Tracer#datadog_tracer.

* Added: Patch for OpenTracing#global_tracer=.
delner added a commit that referenced this pull request Aug 17, 2018
* Added: Datadog::OpenTracer::Tracer#datadog_tracer.

* Added: Patch for OpenTracing#global_tracer=.
@delner delner added this to the 0.16.0 milestone Aug 23, 2018
delner added a commit that referenced this pull request Sep 13, 2018
* Added: Datadog::OpenTracer::Tracer#datadog_tracer.

* Added: Patch for OpenTracing#global_tracer=.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries feature Involves a product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants