opentelemetry-sdk 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83141347c526da6e87b4858c6ad9277ec4d2a59a452944114f21618b86d98db1
4
- data.tar.gz: e1ebac32ea8dbcbb5087bf2d06bae25f5ed269fb7a3e17159d37d41def7b5063
3
+ metadata.gz: 0231dc6f06956325ffb14fc4a209f579001c7cc059659da14d4a4790fd07efeb
4
+ data.tar.gz: 676299747265e10f02eb15ffda455bfcd70155a9969e1f021804fb37c26ba768
5
5
  SHA512:
6
- metadata.gz: 68a19f8ce70e8a1dc00bcea801c16f405f86a826e9501a9e513fd0070adca7e8cbe51f958f6957f8d38bae768fa9f8b4b111c55112d95309bb0bcfb8b85c5e26
7
- data.tar.gz: a25e070825c5d2f886e01c8b1659e63f73810fbae89ac629c4e5b2319391c859db90b87901d294044fc06e8f4bb7879e97ce3549484d408695f7aac0345c1256
6
+ metadata.gz: ea3a1003fd132137846cbf7957da2524e21dca19d0899c9663cebbc5836bd5ce1adafe4b0ecf8f899600a94701b410534ea1eca56409da9e2dc3de658b0cb4c7
7
+ data.tar.gz: ee4b4487c397cee00f0d40854c3c19b7e405bfff70f145ee8520f1ceb924ac7a99cb8b15a43af30c826f59d08028345ab62535d5fef0164c89e43bd6b221d43c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Release History: opentelemetry-sdk
2
2
 
3
+ ### v0.16.0 / 2021-03-17
4
+
5
+ * BREAKING CHANGE: Update SDK BaggageManager to match API
6
+ * BREAKING CHANGE: Implement Exporter#force_flush
7
+
8
+ * ADDED: Add force_flush to SDK's TracerProvider
9
+ * ADDED: Add k8s node to gcp resource detector
10
+ * ADDED: Add console option for OTEL_TRACES_EXPORTER
11
+ * ADDED: Span#add_attributes
12
+ * ADDED: Implement Exporter#force_flush
13
+ * FIXED: Update SDK BaggageManager to match API
14
+ * DOCS: Replace Gitter with GitHub Discussions
15
+
3
16
  ### v0.15.0 / 2021-02-18
4
17
 
5
18
  * BREAKING CHANGE: Streamline processor pipeline
data/README.md CHANGED
@@ -56,7 +56,7 @@ For additional examples, see the [examples on github][examples-github].
56
56
 
57
57
  The `opentelemetry-sdk` gem source is [on github][repo-github], along with related gems including `opentelemetry-api`.
58
58
 
59
- The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on our [gitter channel][ruby-gitter] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
59
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
60
60
 
61
61
  ## License
62
62
 
@@ -70,4 +70,4 @@ The `opentelemetry-sdk` gem is distributed under the Apache 2.0 license. See [LI
70
70
  [examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/examples
71
71
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
72
72
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
73
- [ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
73
+ [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
@@ -22,7 +22,7 @@ module OpenTelemetry
22
22
  # @param [optional Context] context The context to update with with new
23
23
  # modified baggage. Defaults to +Context.current+
24
24
  # @return [Context]
25
- def build_context(context: Context.current)
25
+ def build(context: Context.current)
26
26
  builder = Builder.new(baggage_for(context).dup)
27
27
  yield builder
28
28
  context.set_value(BAGGAGE_KEY, builder.entries)
@@ -154,6 +154,7 @@ module OpenTelemetry
154
154
  when 'otlp' then fetch_exporter(exporter, 'OpenTelemetry::Exporter::OTLP::Exporter')
155
155
  when 'jaeger' then fetch_exporter(exporter, 'OpenTelemetry::Exporter::Jaeger::CollectorExporter')
156
156
  when 'zipkin' then fetch_exporter(exporter, 'OpenTelemetry::Exporter::Zipkin::Exporter')
157
+ when 'console' then Trace::Export::SimpleSpanProcessor.new(Trace::Export::ConsoleSpanExporter.new)
157
158
  else
158
159
  OpenTelemetry.logger.warn "The #{exporter} exporter is unknown and cannot be configured, spans will not be exported"
159
160
  nil
@@ -67,14 +67,59 @@ module OpenTelemetry
67
67
  # The name of the cluster that the pod is running in.
68
68
  cluster_name: 'k8s.cluster.name',
69
69
 
70
+ # The name of the Node.
71
+ node_name: 'k8s.node.name',
72
+
73
+ # The UID of the Node.
74
+ node_uid: 'k8s.node.uid',
75
+
70
76
  # The name of the namespace that the pod is running in.
71
77
  namespace_name: 'k8s.namespace.name',
72
78
 
73
79
  # The name of the pod.
74
80
  pod_name: 'k8s.pod.name',
75
81
 
82
+ # The UID of the Pod.
83
+ pod_uid: 'k8s.pod.uid',
84
+
85
+ # The name of the Container in a Pod template.
86
+ container_name: 'k8s.container.name',
87
+
88
+ # The UID of the ReplicaSet.
89
+ replicaset_uid: 'k8s.replicaset.uid',
90
+
91
+ # The name of the ReplicaSet.
92
+ replicaset_name: 'k8s.replicaset.name',
93
+
94
+ # The UID of the Deployment.
95
+ deployment_uid: 'k8s.deployment.uid',
96
+
76
97
  # The name of the deployment.
77
- deployment_name: 'k8s.deployment.name'
98
+ deployment_name: 'k8s.deployment.name',
99
+
100
+ # The UID of the StatefulSet.
101
+ statefulset_uid: 'k8s.statefulset.uid',
102
+
103
+ # The name of the StatefulSet.
104
+ statefulset_name: 'k8s.statefulset.name',
105
+
106
+ # The UID of the DaemonSet.
107
+ daemonset_uid: 'k8s.daemonset.uid',
108
+
109
+ # The name of the DaemonSet.
110
+ daemonset_name: 'k8s.daemonset.name',
111
+
112
+ # The UID of the Job.
113
+ job_uid: 'k8s.job.uid',
114
+
115
+ # The name of the Job.
116
+ job_name: 'k8s.job.name',
117
+
118
+ # The UID of the CronJob.
119
+ cronjob_uid: 'k8s.cronjob.uid',
120
+
121
+ # The name of the CronJob.
122
+ cronjob_name: 'k8s.cronjob.name'
78
123
  }.freeze
79
124
 
80
125
  # Attributes defining an operating system process.
@@ -114,7 +114,7 @@ module OpenTelemetry
114
114
  return result_code unless result_code == SUCCESS
115
115
  end
116
116
 
117
- SUCCESS
117
+ @exporter.force_flush(timeout: OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time))
118
118
  ensure
119
119
  # Unshift the remaining spans if we timed out. We drop excess spans from
120
120
  # the snapshot because they're older than any spans in the spans buffer.
@@ -26,6 +26,10 @@ module OpenTelemetry
26
26
  SUCCESS
27
27
  end
28
28
 
29
+ def force_flush(timeout: nil)
30
+ SUCCESS
31
+ end
32
+
29
33
  def shutdown(timeout: nil)
30
34
  @stopped = true
31
35
  SUCCESS
@@ -72,6 +72,16 @@ module OpenTelemetry
72
72
  SUCCESS
73
73
  end
74
74
 
75
+ # Called when {TracerProvider#force_flush} is called, if this exporter is
76
+ # registered to a {TracerProvider} object.
77
+ #
78
+ # @param [optional Numeric] timeout An optional timeout in seconds.
79
+ # @return [Integer] SUCCESS if no error occurred, FAILURE if a
80
+ # non-specific failure occurred, TIMEOUT if a timeout occurred.
81
+ def force_flush(timeout: nil)
82
+ SUCCESS
83
+ end
84
+
75
85
  # Called when {TracerProvider#shutdown} is called, if this exporter is
76
86
  # registered to a {TracerProvider} object.
77
87
  #
@@ -36,6 +36,23 @@ module OpenTelemetry
36
36
  results.uniq.max || SUCCESS
37
37
  end
38
38
 
39
+ # Called when {TracerProvider#force_flush} is called, if this exporter is
40
+ # registered to a {TracerProvider} object.
41
+ #
42
+ # @param [optional Numeric] timeout An optional timeout in seconds.
43
+ # @return [Integer] SUCCESS if no error occurred, FAILURE if a
44
+ # non-specific failure occurred, TIMEOUT if a timeout occurred.
45
+ def force_flush(timeout: nil)
46
+ start_time = Time.now
47
+ results = @span_exporters.map do |processor|
48
+ remaining_timeout = OpenTelemetry::Common::Utilities.maybe_timeout(timeout, start_time)
49
+ return TIMEOUT if remaining_timeout&.zero?
50
+
51
+ processor.force_flush(timeout: remaining_timeout)
52
+ end
53
+ results.uniq.max || SUCCESS
54
+ end
55
+
39
56
  # Called when {TracerProvider#shutdown} is called, if this exporter is
40
57
  # registered to a {TracerProvider} object.
41
58
  #
@@ -31,6 +31,16 @@ module OpenTelemetry
31
31
  FAILURE
32
32
  end
33
33
 
34
+ # Called when {TracerProvider#force_flush} is called, if this exporter is
35
+ # registered to a {TracerProvider} object.
36
+ #
37
+ # @param [optional Numeric] timeout An optional timeout in seconds.
38
+ # @return [Integer] SUCCESS if no error occurred, FAILURE if a
39
+ # non-specific failure occurred, TIMEOUT if a timeout occurred.
40
+ def force_flush(timeout: nil)
41
+ SUCCESS
42
+ end
43
+
34
44
  # Called when {TracerProvider#shutdown} is called, if this exporter is
35
45
  # registered to a {TracerProvider} object.
36
46
  #
@@ -61,7 +61,7 @@ module OpenTelemetry
61
61
  end
62
62
 
63
63
  # Export all ended spans to the configured `Exporter` that have not yet
64
- # been exported.
64
+ # been exported, then call {Exporter#force_flush}.
65
65
  #
66
66
  # This method should only be called in cases where it is absolutely
67
67
  # necessary, such as when using some FaaS providers that may suspend
@@ -72,7 +72,7 @@ module OpenTelemetry
72
72
  # @return [Integer] SUCCESS if no error occurred, FAILURE if a
73
73
  # non-specific failure occurred, TIMEOUT if a timeout occurred.
74
74
  def force_flush(timeout: nil)
75
- SUCCESS
75
+ @span_exporter&.force_flush(timeout: timeout) || SUCCESS
76
76
  end
77
77
 
78
78
  # Called when {TracerProvider#shutdown} is called.
@@ -85,6 +85,34 @@ module OpenTelemetry
85
85
  end
86
86
  alias []= set_attribute
87
87
 
88
+ # Add attributes
89
+ #
90
+ # Note that the OpenTelemetry project
91
+ # {https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-semantic-conventions.md
92
+ # documents} certain "standard attributes" that have prescribed semantic
93
+ # meanings.
94
+ #
95
+ # @param [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes
96
+ # Values must be non-nil and (array of) string, boolean or numeric type.
97
+ # Array values must not contain nil elements and all elements must be of
98
+ # the same basic type (string, numeric, boolean).
99
+ #
100
+ # @return [self] returns itself
101
+ def add_attributes(attributes)
102
+ super
103
+ @mutex.synchronize do
104
+ if @ended
105
+ OpenTelemetry.logger.warn('Calling add_attributes on an ended Span.')
106
+ else
107
+ @attributes ||= {}
108
+ @attributes.merge!(attributes)
109
+ trim_span_attributes(@attributes)
110
+ @total_recorded_attributes += attributes.size
111
+ end
112
+ end
113
+ self
114
+ end
115
+
88
116
  # Add an Event to a {Span}.
89
117
  #
90
118
  # Example:
@@ -42,7 +42,7 @@ module OpenTelemetry
42
42
  @mutex.synchronize { @registry[Key.new(name, version)] ||= Tracer.new(name, version, self) }
43
43
  end
44
44
 
45
- # Attempts to stop all the activity for this {Tracer}. Calls
45
+ # Attempts to stop all the activity for this {TracerProvider}. Calls
46
46
  # SpanProcessor#shutdown for all registered SpanProcessors.
47
47
  #
48
48
  # This operation may block until all the Spans are processed. Must be
@@ -63,6 +63,25 @@ module OpenTelemetry
63
63
  end
64
64
  end
65
65
 
66
+ # Immediately export all spans that have not yet been exported for all the
67
+ # registered SpanProcessors.
68
+ #
69
+ # This method should only be called in cases where it is absolutely
70
+ # necessary, such as when using some FaaS providers that may suspend
71
+ # the process after an invocation, but before the `Processor` exports
72
+ # the completed spans.
73
+ #
74
+ # @param [optional Numeric] timeout An optional timeout in seconds.
75
+ # @return [Integer] Export::SUCCESS if no error occurred, Export::FAILURE if
76
+ # a non-specific failure occurred, Export::TIMEOUT if a timeout occurred.
77
+ def force_flush(timeout: nil)
78
+ @mutex.synchronize do
79
+ return Export::SUCCESS if @stopped
80
+
81
+ @active_span_processor.force_flush(timeout: timeout)
82
+ end
83
+ end
84
+
66
85
  # Adds a new SpanProcessor to this {Tracer}.
67
86
  #
68
87
  # @param span_processor the new SpanProcessor to be added.
@@ -7,6 +7,6 @@
7
7
  module OpenTelemetry
8
8
  module SDK
9
9
  ## Current OpenTelemetry version
10
- VERSION = '0.15.0'
10
+ VERSION = '0.16.0'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-18 00:00:00.000000000 Z
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.15.0
19
+ version: 0.16.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.15.0
26
+ version: 0.16.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: opentelemetry-common
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.15.0
33
+ version: 0.16.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.15.0
40
+ version: 0.16.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.15.0
89
+ version: 0.16.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.15.0
96
+ version: 0.16.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -215,10 +215,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
215
215
  licenses:
216
216
  - Apache-2.0
217
217
  metadata:
218
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.15.0/file.CHANGELOG.html
218
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.16.0/file.CHANGELOG.html
219
219
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/sdk
220
220
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
221
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.15.0
221
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-sdk/v0.16.0
222
222
  post_install_message:
223
223
  rdoc_options: []
224
224
  require_paths: