Closed multani closed 10 months ago
When an error occured and after I set span status to ERROR, the span doesn't show up as error in Google Cloud Trace.
ERROR
Consider the following example:
#!/usr/bin/env python3 from opentelemetry import trace from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.trace import Status, StatusCode def setup(): exporter = CloudTraceSpanExporter() # exporter = OTLPSpanExporter(endpoint="127.0.0.1:4317", insecure=True) print(f"Using tracing exporter {exporter}") processor = BatchSpanProcessor(exporter) resource = Resource(attributes={SERVICE_NAME: "test"}) tracer_provider = TracerProvider(resource=resource) tracer_provider.add_span_processor(processor) trace.set_tracer_provider(tracer_provider) def main(): setup() tracer = trace.get_tracer(__name__) with tracer.start_as_current_span("first") as span: try: raise Exception("oh no") except Exception as exc: span.record_exception(exc) span.set_status(Status(StatusCode.ERROR)) # span.set_attribute("http.status_code", 500) if __name__ == "__main__": main()
It shows up like this in Google Cloud Trace:
If I switch the exporter from CloudTraceSpanExporter to the OTLPSpanExporter (towards Jaeger), it shows up correctly in Jaeger:
CloudTraceSpanExporter
OTLPSpanExporter
Setting the span attribute http.status_code to 500 shows up correctly though, but this doesn't use the "official" status mechanism from OpenTelemetry:
http.status_code
500
@multani this was also reported in https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/issues/730
Unfortunately we can't do anything in the exporter to fix it. Please follow along on that bug.
When an error occured and after I set span status to
ERROR
, the span doesn't show up as error in Google Cloud Trace.Consider the following example:
It shows up like this in Google Cloud Trace:
If I switch the exporter from
CloudTraceSpanExporter
to theOTLPSpanExporter
(towards Jaeger), it shows up correctly in Jaeger:Setting the span attribute
http.status_code
to500
shows up correctly though, but this doesn't use the "official" status mechanism from OpenTelemetry: