opentelemetry-sdk 0.4.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -2
- data/CHANGELOG.md +42 -0
- data/README.md +1 -1
- data/lib/opentelemetry/sdk.rb +4 -3
- data/lib/opentelemetry/sdk/baggage.rb +16 -0
- data/lib/opentelemetry/sdk/{correlation_context → baggage}/builder.rb +5 -5
- data/lib/opentelemetry/sdk/{correlation_context → baggage}/manager.rb +37 -27
- data/lib/opentelemetry/sdk/configurator.rb +73 -39
- data/lib/opentelemetry/sdk/instrumentation_library.rb +13 -0
- data/lib/opentelemetry/sdk/resources.rb +1 -0
- data/lib/opentelemetry/sdk/resources/constants.rb +120 -0
- data/lib/opentelemetry/sdk/resources/resource.rb +38 -19
- data/lib/opentelemetry/sdk/trace.rb +1 -0
- data/lib/opentelemetry/sdk/trace/config/trace_config.rb +3 -3
- data/lib/opentelemetry/sdk/trace/event.rb +48 -0
- data/lib/opentelemetry/sdk/trace/export.rb +9 -9
- data/lib/opentelemetry/sdk/trace/export/batch_span_processor.rb +49 -28
- data/lib/opentelemetry/sdk/trace/export/console_span_exporter.rb +3 -6
- data/lib/opentelemetry/sdk/trace/export/in_memory_span_exporter.rb +6 -2
- data/lib/opentelemetry/sdk/trace/export/multi_span_exporter.rb +7 -8
- data/lib/opentelemetry/sdk/trace/export/noop_span_exporter.rb +2 -1
- data/lib/opentelemetry/sdk/trace/export/simple_span_processor.rb +13 -3
- data/lib/opentelemetry/sdk/trace/multi_span_processor.rb +12 -4
- data/lib/opentelemetry/sdk/trace/noop_span_processor.rb +15 -3
- data/lib/opentelemetry/sdk/trace/samplers.rb +52 -51
- data/lib/opentelemetry/sdk/trace/samplers/constant_sampler.rb +33 -0
- data/lib/opentelemetry/sdk/trace/samplers/decision.rb +3 -3
- data/lib/opentelemetry/sdk/trace/samplers/parent_based.rb +53 -0
- data/lib/opentelemetry/sdk/trace/samplers/result.rb +3 -3
- data/lib/opentelemetry/sdk/trace/samplers/trace_id_ratio_based.rb +45 -0
- data/lib/opentelemetry/sdk/trace/span.rb +33 -36
- data/lib/opentelemetry/sdk/trace/span_data.rb +18 -3
- data/lib/opentelemetry/sdk/trace/tracer.rb +36 -20
- data/lib/opentelemetry/sdk/trace/tracer_provider.rb +4 -4
- data/lib/opentelemetry/sdk/version.rb +1 -1
- metadata +19 -10
- data/lib/opentelemetry/sdk/correlation_context.rb +0 -16
- data/lib/opentelemetry/sdk/trace/samplers/probability_sampler.rb +0 -61
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2019 OpenTelemetry Authors
|
4
|
-
#
|
5
|
-
# SPDX-License-Identifier: Apache-2.0
|
6
|
-
|
7
|
-
require 'opentelemetry/sdk/correlation_context/builder'
|
8
|
-
require 'opentelemetry/sdk/correlation_context/manager'
|
9
|
-
|
10
|
-
module OpenTelemetry
|
11
|
-
module SDK
|
12
|
-
# Contains operational implementataions of the CorrelationContext::Manager
|
13
|
-
module CorrelationContext
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2019 OpenTelemetry Authors
|
4
|
-
#
|
5
|
-
# SPDX-License-Identifier: Apache-2.0
|
6
|
-
|
7
|
-
module OpenTelemetry
|
8
|
-
module SDK
|
9
|
-
module Trace
|
10
|
-
module Samplers
|
11
|
-
# @api private
|
12
|
-
#
|
13
|
-
# Implements sampling based on a probability.
|
14
|
-
class ProbabilitySampler
|
15
|
-
def initialize(probability, ignore_parent:, apply_to_remote_parent:, apply_to_all_spans:)
|
16
|
-
@probability = probability
|
17
|
-
@id_upper_bound = format('%016x', (probability * (2**64 - 1)).ceil)
|
18
|
-
@use_parent_sampled_flag = !ignore_parent
|
19
|
-
@apply_to_remote_parent = apply_to_remote_parent
|
20
|
-
@apply_to_all_spans = apply_to_all_spans
|
21
|
-
end
|
22
|
-
|
23
|
-
# @api private
|
24
|
-
#
|
25
|
-
# Callable interface for probability sampler. See {Samplers}.
|
26
|
-
def call(trace_id:, span_id:, parent_context:, links:, name:, kind:, attributes:)
|
27
|
-
# Ignored for sampling decision: links, name, kind, attributes.
|
28
|
-
|
29
|
-
if sample?(trace_id, parent_context)
|
30
|
-
RECORD_AND_SAMPLED
|
31
|
-
else
|
32
|
-
NOT_RECORD
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def sample?(trace_id, parent_context)
|
39
|
-
if parent_context.nil?
|
40
|
-
sample_trace_id?(trace_id)
|
41
|
-
else
|
42
|
-
parent_sampled?(parent_context) || sample_trace_id_for_child?(parent_context, trace_id)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def parent_sampled?(parent_context)
|
47
|
-
@use_parent_sampled_flag && parent_context.trace_flags.sampled?
|
48
|
-
end
|
49
|
-
|
50
|
-
def sample_trace_id_for_child?(parent_context, trace_id)
|
51
|
-
(@apply_to_all_spans || (@apply_to_remote_parent && parent_context.remote?)) && sample_trace_id?(trace_id)
|
52
|
-
end
|
53
|
-
|
54
|
-
def sample_trace_id?(trace_id)
|
55
|
-
@probability == 1.0 || trace_id[16, 16] < @id_upper_bound
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|