lib/opentelemetry/exporter/otlp/exporter.rb in opentelemetry-exporter-otlp-0.6.0 vs lib/opentelemetry/exporter/otlp/exporter.rb in opentelemetry-exporter-otlp-0.7.0
- old
+ new
@@ -213,11 +213,11 @@
def as_otlp_span(span_data) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
Opentelemetry::Proto::Trace::V1::Span.new(
trace_id: span_data.trace_id,
span_id: span_data.span_id,
trace_state: span_data.tracestate,
- parent_span_id: span_data.parent_span_id,
+ parent_span_id: span_data.parent_span_id == OpenTelemetry::Trace::INVALID_SPAN_ID ? nil : span_data.parent_span_id,
name: span_data.name,
kind: as_otlp_span_kind(span_data.kind),
start_time_unix_nano: as_otlp_timestamp(span_data.start_timestamp),
end_time_unix_nano: as_otlp_timestamp(span_data.end_timestamp),
attributes: span_data.attributes&.map { |k, v| as_otlp_key_value(k, v) },
@@ -240,11 +240,12 @@
# TODO: track dropped_attributes_count in Span#trim_links
)
end,
dropped_links_count: span_data.total_recorded_links - span_data.links&.size.to_i,
status: span_data.status&.yield_self do |status|
+ # TODO: fix this based on spec update.
Opentelemetry::Proto::Trace::V1::Status.new(
- code: status.canonical_code,
+ code: status.canonical_code == OpenTelemetry::Trace::Status::ERROR ? Opentelemetry::Proto::Trace::V1::Status::StatusCode::UnknownError : Opentelemetry::Proto::Trace::V1::Status::StatusCode::Ok,
message: status.description
)
end
)
end