23 Sep 2024 04:24 PM - last edited on 24 Sep 2024 07:38 AM by MaciejNeumann
The Gravitee.io API gateway is not a directly supported technology by OneAgent. Without support you are unable to see any processing within the API gateway and traces stop at the API gateway. Luckily, there is a trace plugin for OpenTelemetry at https://www.gravitee.io/plugins/gravitee-tracer-opentelemetry .
Steps to get this working:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
resource:
attributes:
- key: dt.entity.host
value: <HOST>
action: upsert
- key: dt.entity.process_group_instance
value: <PROCESS_GROUP_INSTANCE>
action: upsert
exporters:
otlphttp:
endpoint: <ENVIRONMENT>/api/v2/otlp
headers:
Authorization: "Api-Token <APITOKEN>"
service:
pipelines:
traces:
receivers: [otlp]
processors: [resource]
exporters: [otlphttp]
metrics:
receivers: [otlp]
processors: [resource]
exporters: [otlphttp]
logs:
receivers: [otlp]
processors: [resource]
exporters: [otlphttp]
tracing:
enabled: true
type: otel
otel:
url: grpc://localhost:4317
13:58:09.943 [graviteeio-node] [] INFO i.g.node.tracing.TracingService - Tracing support is enabled with tracer: name[otel]
Just a few notes:
11 Oct 2024 10:01 AM
Hello Julius, thanks for this tutorial! Especially for the note on OTLP HTTP output. The OneAgent is deployed on the gateway. We thought we would be able to capture the OpenTelemetry traces directly, but it was not possible without the OTel Collector.
17 Oct 2024 07:44 AM
If you have OneAgent on the gravitee host, normally OneAgent will collect the OTEL traces and the collector is not required. Unfortunately, Gravitee configuration for OpenTelemetry plugin requires a valid configuration and output, otherwise, it will produce a lot of errors about the plugin being unable to export traces.
So a valid destination in Gravitee is needed. It's not possible to include and enable the plugin without it.
11 Oct 2024 10:29 AM
Thanks for the detailed configuration. While not a Gravitee.io user, it's great to know how certain services are implementing OpenTelemetry and how they integrate with Dynatrace.
11 Oct 2024 11:12 AM
It seems that my traces aren't complete, I think Gravitee remove headers, did it happened to you ?
Can you confirm the header that I need to be forwarded by Gravitee, I supposed the following:
- x-dynatrace
- traceparent
- tracestate
Is there anything else I should be carefull about ?
11 Oct 2024 03:35 PM
@agonzalez it did not happen in my case. Maybe this is specific to your gravitee.io setup (a policy removing specific headers?) or something else is removing headers. I recommend setting up request attributes on the services to capture the values. You need just w3c headers (traceparent, tracestate) for this to work.
Basically, the tricky part was just the OTLP HTTP setup which produces JSON only and this is not mentioned in the docs.
One important caveat is the enrichment of traces with Dynatrace resource attributes, so your trace ingest is covered by a full-stack oneagent license - but that's already in my setup above.