opentelemetry-logs-sdk 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/opentelemetry/sdk/logs/configurator_patch.rb +4 -4
- data/lib/opentelemetry/sdk/logs/export/batch_log_record_processor.rb +3 -3
- data/lib/opentelemetry/sdk/logs/export.rb +1 -1
- data/lib/opentelemetry/sdk/logs/log_record.rb +28 -20
- data/lib/opentelemetry/sdk/logs/log_record_data.rb +1 -1
- data/lib/opentelemetry/sdk/logs/logger_provider.rb +3 -3
- data/lib/opentelemetry/sdk/logs/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 36d592eec04d747c1678b79a1f89bcfe61b556e78fa058fd50e2f0a628ef92f3
|
|
4
|
+
data.tar.gz: 22b6b008bbd2554105928845bd1478f52278100439b75a04dcac1cbebb94ddd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac4f7deea07aac2d3d51e87592797d0aa9bc5efdcb1ee2a61305062398ea7aae7790cc156ac7ca94d865feccfc120b9f76ce63e43913a64ef8d11c510a5dbc62
|
|
7
|
+
data.tar.gz: dc1b3af7fe9e9523c56264453dbe624e5d6b6b407fdfb9674c441c605d7f5f7d0cb3e6ed22dac25cb9f8fdd1b48230d8ec623b6c3e5198b2fe745b471ff9c345
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Release History: opentelemetry-logs-sdk
|
|
2
2
|
|
|
3
|
+
### v0.7.0 / 2026-09-29
|
|
4
|
+
|
|
5
|
+
* ADDED: Move otlp exporter uri builder to common (#2240)
|
|
6
|
+
* FIXED: Update total_recorded_attributes when LogRecord#attributes= is called (#2241)
|
|
7
|
+
|
|
3
8
|
### v0.6.1 / 2026-07-08
|
|
4
9
|
|
|
5
10
|
* DOCS: Update source for gemspec links to RubyDoc (#2123)
|
|
@@ -45,16 +45,16 @@ module OpenTelemetry
|
|
|
45
45
|
when 'otlp'
|
|
46
46
|
otlp_protocol = ENV['OTEL_EXPORTER_OTLP_LOGS_PROTOCOL'] || ENV['OTEL_EXPORTER_OTLP_PROTOCOL'] || 'http/protobuf'
|
|
47
47
|
|
|
48
|
-
if otlp_protocol
|
|
49
|
-
OpenTelemetry.logger.warn "The #{otlp_protocol} transport protocol is not supported by the OTLP exporter, log_records will not be exported."
|
|
50
|
-
nil
|
|
51
|
-
else
|
|
48
|
+
if otlp_protocol == 'http/protobuf'
|
|
52
49
|
begin
|
|
53
50
|
Logs::Export::BatchLogRecordProcessor.new(OpenTelemetry::Exporter::OTLP::Logs::LogsExporter.new)
|
|
54
51
|
rescue NameError
|
|
55
52
|
OpenTelemetry.logger.warn 'The otlp logs exporter cannot be configured - please add opentelemetry-exporter-otlp-logs to your Gemfile. Logs will not be exported'
|
|
56
53
|
nil
|
|
57
54
|
end
|
|
55
|
+
else
|
|
56
|
+
OpenTelemetry.logger.warn "The #{otlp_protocol} transport protocol is not supported by the OTLP exporter, log_records will not be exported."
|
|
57
|
+
nil
|
|
58
58
|
end
|
|
59
59
|
else
|
|
60
60
|
OpenTelemetry.logger.warn "The #{exporter} exporter is unknown and cannot be configured, log records will not be exported"
|
|
@@ -39,7 +39,7 @@ module OpenTelemetry
|
|
|
39
39
|
schedule_delay: Float(ENV.fetch('OTEL_BLRP_SCHEDULE_DELAY', 1000)),
|
|
40
40
|
max_queue_size: Integer(ENV.fetch('OTEL_BLRP_MAX_QUEUE_SIZE', 2048)),
|
|
41
41
|
max_export_batch_size: Integer(ENV.fetch('OTEL_BLRP_MAX_EXPORT_BATCH_SIZE', 512)),
|
|
42
|
-
start_thread_on_boot: String(ENV
|
|
42
|
+
start_thread_on_boot: String(ENV.fetch('OTEL_RUBY_BLRP_START_THREAD_ON_BOOT', '')) !~ /false/i)
|
|
43
43
|
unless max_export_batch_size <= max_queue_size
|
|
44
44
|
raise ArgumentError,
|
|
45
45
|
'max_export_batch_size much be less than or equal to max_queue_size'
|
|
@@ -208,8 +208,8 @@ module OpenTelemetry
|
|
|
208
208
|
log_records.shift(@batch_size).map!(&:to_log_record_data)
|
|
209
209
|
end
|
|
210
210
|
|
|
211
|
-
def lock(&
|
|
212
|
-
@mutex.synchronize(&
|
|
211
|
+
def lock(&)
|
|
212
|
+
@mutex.synchronize(&)
|
|
213
213
|
end
|
|
214
214
|
end
|
|
215
215
|
end
|
|
@@ -10,7 +10,7 @@ module OpenTelemetry
|
|
|
10
10
|
# The Export module contains the built-in exporters and log record
|
|
11
11
|
# processors for the OpenTelemetry reference implementation.
|
|
12
12
|
module Export
|
|
13
|
-
ExportError = Class.new(OpenTelemetry::Error)
|
|
13
|
+
ExportError = Class.new(OpenTelemetry::Error) # rubocop:disable Style/EmptyClassDefinition
|
|
14
14
|
# The operation finished successfully.
|
|
15
15
|
SUCCESS = 0
|
|
16
16
|
|
|
@@ -18,7 +18,6 @@ module OpenTelemetry
|
|
|
18
18
|
:severity_text,
|
|
19
19
|
:severity_number,
|
|
20
20
|
:body,
|
|
21
|
-
:attributes,
|
|
22
21
|
:event_name,
|
|
23
22
|
:trace_id,
|
|
24
23
|
:span_id,
|
|
@@ -26,6 +25,8 @@ module OpenTelemetry
|
|
|
26
25
|
:resource,
|
|
27
26
|
:instrumentation_scope
|
|
28
27
|
|
|
28
|
+
attr_reader :attributes
|
|
29
|
+
|
|
29
30
|
# Creates a new {LogRecord}.
|
|
30
31
|
#
|
|
31
32
|
# @param [optional Time] timestamp Time when the event occurred.
|
|
@@ -81,7 +82,6 @@ module OpenTelemetry
|
|
|
81
82
|
@severity_text = severity_text
|
|
82
83
|
@severity_number = severity_number
|
|
83
84
|
@body = body
|
|
84
|
-
@attributes = attributes.nil? ? nil : Hash[attributes] # We need a mutable copy of attributes
|
|
85
85
|
@event_name = event_name
|
|
86
86
|
@trace_id = trace_id
|
|
87
87
|
@span_id = span_id
|
|
@@ -89,9 +89,18 @@ module OpenTelemetry
|
|
|
89
89
|
@resource = resource
|
|
90
90
|
@instrumentation_scope = instrumentation_scope
|
|
91
91
|
@log_record_limits = log_record_limits || LogRecordLimits::DEFAULT
|
|
92
|
-
@
|
|
92
|
+
@dropped_attributes_count = 0
|
|
93
|
+
self.attributes = attributes
|
|
94
|
+
end
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
# Sets the attributes for this {LogRecord} and reapplies the
|
|
97
|
+
# configured attribute limits.
|
|
98
|
+
#
|
|
99
|
+
# @param [optional Hash{String => String, Numeric, Boolean,
|
|
100
|
+
# Array<String, Numeric, Boolean>}] new_attributes Attributes to
|
|
101
|
+
# associate with the {LogRecord}.
|
|
102
|
+
def attributes=(new_attributes)
|
|
103
|
+
trim_attributes(@attributes = new_attributes&.to_h) # We need a mutable copy of attributes
|
|
95
104
|
end
|
|
96
105
|
|
|
97
106
|
def to_log_record_data
|
|
@@ -108,36 +117,35 @@ module OpenTelemetry
|
|
|
108
117
|
@trace_flags,
|
|
109
118
|
@resource,
|
|
110
119
|
@instrumentation_scope,
|
|
111
|
-
@
|
|
120
|
+
@dropped_attributes_count
|
|
112
121
|
)
|
|
113
122
|
end
|
|
114
123
|
|
|
115
124
|
private
|
|
116
125
|
|
|
117
126
|
def to_integer_nanoseconds(timestamp)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
(timestamp.to_r * 10**9).to_i
|
|
127
|
+
(timestamp.to_r * (10**9)).to_i if timestamp.is_a?(Time)
|
|
121
128
|
end
|
|
122
129
|
|
|
123
|
-
def trim_attributes(
|
|
124
|
-
return if
|
|
130
|
+
def trim_attributes(attrs)
|
|
131
|
+
return if attrs.nil?
|
|
125
132
|
|
|
126
133
|
# truncate total attributes
|
|
127
|
-
truncate_attributes(
|
|
134
|
+
truncate_attributes(attrs, @log_record_limits.attribute_count_limit)
|
|
128
135
|
|
|
129
136
|
# truncate attribute values
|
|
130
|
-
truncate_attribute_values(
|
|
137
|
+
truncate_attribute_values(attrs, @log_record_limits.attribute_length_limit)
|
|
131
138
|
|
|
132
139
|
# validate attributes
|
|
133
|
-
validate_attributes(
|
|
134
|
-
|
|
135
|
-
nil
|
|
140
|
+
validate_attributes(attrs)
|
|
136
141
|
end
|
|
137
142
|
|
|
138
|
-
def truncate_attributes(
|
|
139
|
-
excess =
|
|
140
|
-
|
|
143
|
+
def truncate_attributes(attrs, attribute_limit)
|
|
144
|
+
excess = attrs.size - attribute_limit
|
|
145
|
+
return unless excess.positive?
|
|
146
|
+
|
|
147
|
+
excess.times { attrs.shift }
|
|
148
|
+
@dropped_attributes_count += excess
|
|
141
149
|
end
|
|
142
150
|
|
|
143
151
|
def validate_attributes(attrs)
|
|
@@ -146,11 +154,11 @@ module OpenTelemetry
|
|
|
146
154
|
attrs.keep_if do |k, v|
|
|
147
155
|
if !Internal.valid_key?(k)
|
|
148
156
|
OpenTelemetry.handle_error(message: "Invalid log record attribute key type #{k.class} for " \
|
|
149
|
-
|
|
157
|
+
"key #{k.inspect} on record: '#{body}'. Attribute keys must be Strings. Dropping attribute.")
|
|
150
158
|
return false
|
|
151
159
|
elsif !Internal.valid_value?(v)
|
|
152
160
|
OpenTelemetry.handle_error(message: "Invalid log record attribute value type #{v.class} for key '#{k}' " \
|
|
153
|
-
|
|
161
|
+
"on record: '#{body}'. Dropping attribute.")
|
|
154
162
|
return false
|
|
155
163
|
end
|
|
156
164
|
|
|
@@ -20,7 +20,7 @@ module OpenTelemetry
|
|
|
20
20
|
:trace_flags, # optional Integer (8-bit byte of bit flags)
|
|
21
21
|
:resource, # optional OpenTelemetry::SDK::Resources::Resource
|
|
22
22
|
:instrumentation_scope, # optional OpenTelemetry::SDK::InstrumentationScope
|
|
23
|
-
:
|
|
23
|
+
:dropped_attributes_count) # Integer
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -13,7 +13,7 @@ module OpenTelemetry
|
|
|
13
13
|
private_constant(:Key)
|
|
14
14
|
|
|
15
15
|
UNEXPECTED_ERROR_MESSAGE = 'unexpected error in ' \
|
|
16
|
-
|
|
16
|
+
'OpenTelemetry::SDK::Logs::LoggerProvider#%s'
|
|
17
17
|
|
|
18
18
|
private_constant :UNEXPECTED_ERROR_MESSAGE
|
|
19
19
|
|
|
@@ -46,7 +46,7 @@ module OpenTelemetry
|
|
|
46
46
|
|
|
47
47
|
if !name.is_a?(String) || name.empty?
|
|
48
48
|
OpenTelemetry.logger.warn('LoggerProvider#logger called with an ' \
|
|
49
|
-
|
|
49
|
+
"invalid name. Name provided: #{name.inspect}")
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
@registry_mutex.synchronize do
|
|
@@ -63,7 +63,7 @@ module OpenTelemetry
|
|
|
63
63
|
@mutex.synchronize do
|
|
64
64
|
if @stopped
|
|
65
65
|
OpenTelemetry.logger.warn('calling LoggerProvider#' \
|
|
66
|
-
|
|
66
|
+
'add_log_record_processor after shutdown.')
|
|
67
67
|
return
|
|
68
68
|
end
|
|
69
69
|
@log_record_processors = @log_record_processors.dup.push(log_record_processor)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-logs-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
@@ -80,10 +80,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
|
80
80
|
licenses:
|
|
81
81
|
- Apache-2.0
|
|
82
82
|
metadata:
|
|
83
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-logs-sdk/0.
|
|
84
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-logs-sdk/v0.
|
|
83
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-logs-sdk/0.7.0/file/CHANGELOG.md
|
|
84
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-logs-sdk/v0.7.0/logs_sdk
|
|
85
85
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
|
86
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-logs-sdk/0.
|
|
86
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-logs-sdk/0.7.0
|
|
87
87
|
rdoc_options: []
|
|
88
88
|
require_paths:
|
|
89
89
|
- lib
|
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: '0'
|
|
100
100
|
requirements: []
|
|
101
|
-
rubygems_version: 4.0.
|
|
101
|
+
rubygems_version: 4.0.20
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: Logs SDK implementation for OpenTelemetry
|
|
104
104
|
test_files: []
|