Skip to content

Commit

Permalink
[core] Remove runtime-id tag (#773)
Browse files Browse the repository at this point in the history
* [core] Remove runtime-id tag

* fix failing tests
  • Loading branch information
brettlangdon authored Jun 27, 2019
1 parent 1a9ff12 commit c21accf
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 24 deletions.
1 change: 0 additions & 1 deletion docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,6 @@ In addition, all metrics will include the following tags:
| Name | Description |
| ------------ | ------------------------------------------------------- |
| `language` | Programming language traced. (e.g. `ruby`) |
| `runtime-id` | Unique identifier of runtime environment (i.e. process) |
| `service` | List of services this metric is associated with. |

### OpenTracing
Expand Down
1 change: 0 additions & 1 deletion lib/ddtrace/ext/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Metrics
TAG_LANG = 'language'.freeze
TAG_LANG_INTERPRETER = 'language-interpreter'.freeze
TAG_LANG_VERSION = 'language-version'.freeze
TAG_RUNTIME_ID = 'runtime-id'.freeze
TAG_TRACER_VERSION = 'tracer-version'.freeze
end
end
Expand Down
1 change: 0 additions & 1 deletion lib/ddtrace/ext/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module Runtime
TRACER_VERSION = Datadog::VERSION::STRING

TAG_LANG = 'language'.freeze
TAG_RUNTIME_ID = 'runtime-id'.freeze

# Metrics
module Metrics
Expand Down
3 changes: 0 additions & 3 deletions lib/ddtrace/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ def default_metric_options
# and defaults are unfrozen for mutation in Statsd.
DEFAULT.dup.tap do |options|
options[:tags] = options[:tags].dup

# Add runtime ID dynamically because it might change during fork.
options[:tags] << "#{Ext::Metrics::TAG_RUNTIME_ID}:#{Runtime::Identity.id}".freeze
end
end
end
Expand Down
1 change: 0 additions & 1 deletion lib/ddtrace/runtime/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def associate_with_span(span)

# Tag span with language and runtime ID for association with metrics
span.set_tag(Ext::Runtime::TAG_LANG, Runtime::Identity.lang)
span.set_tag(Ext::Runtime::TAG_RUNTIME_ID, Runtime::Identity.id)
end

# Associate service with runtime metrics
Expand Down
3 changes: 0 additions & 3 deletions spec/ddtrace/contrib/rack/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
# Queue span gets tagged for runtime metrics because its a local root span.
# TODO: It probably shouldn't get tagged like this in the future; it's not part of the runtime.
expect(queue_span.get_tag(Datadog::Ext::Runtime::TAG_LANG)).to eq('ruby')
expect(queue_span.get_tag(Datadog::Ext::Runtime::TAG_RUNTIME_ID)).to eq(Datadog::Runtime::Identity.id)

expect(rack_span.name).to eq('rack.request')
expect(rack_span.span_type).to eq('web')
Expand All @@ -89,7 +88,6 @@
expect(rack_span.get_tag('http.status_code')).to eq('200')
expect(rack_span.get_tag('http.url')).to eq('/')
expect(rack_span.get_tag(Datadog::Ext::Runtime::TAG_LANG)).to eq('ruby')
expect(rack_span.get_tag(Datadog::Ext::Runtime::TAG_RUNTIME_ID)).to eq(Datadog::Runtime::Identity.id)
expect(rack_span.status).to eq(0)

expect(queue_span.span_id).to eq(rack_span.parent_id)
Expand All @@ -110,7 +108,6 @@
expect(span.get_tag('http.status_code')).to eq('200')
expect(span.get_tag('http.url')).to eq('/')
expect(span.get_tag(Datadog::Ext::Runtime::TAG_LANG)).to eq('ruby')
expect(span.get_tag(Datadog::Ext::Runtime::TAG_RUNTIME_ID)).to eq(Datadog::Runtime::Identity.id)
expect(span.status).to eq(0)

expect(span.parent_id).to eq(0)
Expand Down
9 changes: 2 additions & 7 deletions spec/ddtrace/runtime/metrics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
expect(span).to receive(:set_tag)
.with(Datadog::Ext::Runtime::TAG_LANG, Datadog::Runtime::Identity.lang)

expect(span).to receive(:set_tag)
.with(Datadog::Ext::Runtime::TAG_RUNTIME_ID, Datadog::Runtime::Identity.id)

associate_with_span
end

Expand Down Expand Up @@ -130,10 +127,9 @@

context 'when no services have been registered' do
it do
is_expected.to have(2).items
is_expected.to have(1).items

is_expected.to include('language:ruby')
is_expected.to include("runtime-id:#{Datadog::Runtime::Identity.id}")
end
end

Expand All @@ -142,10 +138,9 @@
before(:each) { services.each { |service| runtime_metrics.register_service(service) } }

it do
is_expected.to have(4).items
is_expected.to have(3).items

is_expected.to include('language:ruby')
is_expected.to include("runtime-id:#{Datadog::Runtime::Identity.id}")
is_expected.to include(*services.collect { |service| "service:#{service}" })
end
end
Expand Down
6 changes: 0 additions & 6 deletions spec/ddtrace/tracer_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ def lang_tag(span)
span.get_tag(Datadog::Ext::Runtime::TAG_LANG)
end

def runtime_id_tag(span)
span.get_tag(Datadog::Ext::Runtime::TAG_RUNTIME_ID)
end

describe '#active_root_span' do
subject(:active_root_span) { tracer.active_root_span }

Expand Down Expand Up @@ -67,15 +63,13 @@ def runtime_id_tag(span)
it { expect(sampling_priority_metric(parent_span)).to eq(1) }
it { expect(origin_tag(parent_span)).to eq('synthetics') }
it { expect(lang_tag(parent_span)).to eq('ruby') }
it { expect(runtime_id_tag(parent_span)).to eq(Datadog::Runtime::Identity.id) }
it { expect(child_span.name).to eq(child_span_name) }
it { expect(child_span.finished?).to be(true) }
it { expect(child_span.trace_id).to eq(parent_span.trace_id) }
it { expect(child_span.parent_id).to eq(parent_span.span_id) }
it { expect(sampling_priority_metric(child_span)).to eq(1) }
it { expect(origin_tag(child_span)).to eq('synthetics') }
it { expect(lang_tag(child_span)).to eq('ruby') }
it { expect(runtime_id_tag(child_span)).to eq(Datadog::Runtime::Identity.id) }
# This is expected to be child_span because when propagated, we don't
# propagate the root span, only its ID. Therefore the span reference
# should be the first span on the other end of the distributed trace.
Expand Down
2 changes: 1 addition & 1 deletion test/tracer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_trace_all_args
assert_equal('special-service', span.service)
assert_equal('extra-resource', span.resource)
assert_equal('my-type', span.span_type)
assert_equal(7, span.meta.length)
assert_equal(6, span.meta.length)
assert_equal('test', span.get_tag('env'))
assert_equal('cool', span.get_tag('temp'))
assert_equal('value1', span.get_tag('tag1'))
Expand Down

0 comments on commit c21accf

Please sign in to comment.