23 Sep 2024 04:24 PM - edited 05 Jan 2026 04:01 PM
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 OpenTelemetry support for Gravitee 4.x helping to overcome this.
If you run OneAgent on the Gravitee Gateway host, either turn off deep monitoring for the Gateway process or turn off the following OneAgent features for the Gravitee Gateway process groups, otherwise, you will have duplicate spans and/or tracing is broken.
services:
opentelemetry:
enabled: true
verbose: false
exporter:
endpoint: <DT_ENVIRONMENT>/api/v2/otlp
protocol: http/protobuf
compression: gzip
headers:
- Authorization: api-token <API_TOKEN>Adjust other parameters, if necessary, such as SSL (typically needed in Managed environments only) or proxy.
If you want to send traces using locally running full-stack OneAgent, you can simplify the configuration a little bit, and spans are also included in the OneAgent full-stack license compared to Option 1.
services:
opentelemetry:
enabled: true
verbose: false
exporter:
endpoint: http://localhost:14499/otlp
protocol: http/protobuf
compression: noneThis requires Dynatrace Operator 1.6 or newer on the cluster running Gravitee gateway.
services:
opentelemetry:
enabled: true
verbose: false
exporter:
endpoint: http://dynakube-telemetry-ingest.dynatrace.svc:4317
protocol: grpcIf you want a relation between the Unified service and process group instance, you need to add the resource attributes dt.entity.process_group_instance and dt.entity.host (added automatically if you send traces using locally installed OneAgent (option two). Although adding resource attributes can be accomplished by adding extraAttributes parameter in Gravitee, it does not work for keys with an underscore character, so an easier solution is to use OpenTelemetry Collector or Dynatrace collector to add the values. See an example below using the locally installed OneAgent as final ingest endpoint:
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: http://localhost:14499/otlp
service:
pipelines:
traces:
receivers: [otlp]
processors: [resource]
exporters: [otlphttp]
metrics:
receivers: [otlp]
processors: [resource]
exporters: [otlphttp]
logs:
receivers: [otlp]
processors: [resource]
exporters: [otlphttp]
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.
Featured Posts