You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Log severity numbers will be wrong once opentelemetry-exporter-otlp-logs ships opentelemetry-ruby#2434 #116
scout_apm_logging translates Ruby Logger severities into OTLP severity numbers by patching OpenTelemetry::Exporter::OTLP::Logs::LogsExporter#as_otlp_log_record, in lib/scout_apm/logging/loggers/opentelemetry/log_record_patch.rb.
open-telemetry/opentelemetry-ruby#2434 removes that method from LogsExporter. It was merged on 2026-10-07 but isn't released yet; the latest opentelemetry-exporter-otlp-logs is 0.6.0. The PR moves log encoding into OpenTelemetry::Exporter::OTLP::Common.as_encoded_elsr, which has its own as_otlp_log_record. Once a release includes it, Scout's patch will never be called. The gemspec allows opentelemetry-exporter-otlp-logs >= 0.2.0, so apps will pick that release up on a routine bundle update.
Effect
Formatter#emit_log passes severity_number: ::Logger::Severity.const_get(severity), which is Ruby's Logger numbering. Without the patch, the exporter sends those numbers unchanged, and OTLP reads them as different levels:
Ruby Logger
Number sent
OTLP SeverityNumber
DEBUG
0
UNSPECIFIED
INFO
1
TRACE
WARN
2
TRACE2
ERROR
3
TRACE3
FATAL
4
TRACE4
UNKNOWN
5
DEBUG
severity_text stays correct.
Where this is in upstream main
exporter/otlp-logs/lib/opentelemetry/exporter/otlp/logs/logs_exporter.rb encodes with OpenTelemetry::Exporter::OTLP::Common.as_encoded_elsr(log_record_data). LogsExporter no longer defines as_otlp_log_record.
exporter/otlp-common/lib/opentelemetry/exporter/otlp/common.rb defines as_otlp_log_record with severity_number: log_record_data.severity_number, unchanged.
This comes from reading upstream source. It hasn't been run against a release, because none includes it yet.
Suggestion
Map the severity where the record is created. Formatter#emit_log could pass OTLP numbers to on_emit:
Ruby Logger
OTLP SeverityNumber
DEBUG
5
INFO
9
WARN
13
ERROR
17
FATAL
21
UNKNOWN
0 (UNSPECIFIED)
That works with any exporter that passes severity_number through: 0.6.0 does, and so does the upstream main code above. The exporter patch would then no longer be needed for severity. Older exporters that dropped the severity number may need a higher minimum opentelemetry-exporter-otlp-logs in the gemspec. Upper bounds on the pre-1.0 OpenTelemetry gems would also stop changes like this from arriving through a routine update.
Written by Claude, an AI assistant made by Anthropic, on behalf of @rpearce.
Activity
rpearce commentedon Oct 18, 2026
Fixed by #119.