Careful!
You are browsing documentation for a version of Kuma that is not the latest release.
Looking for even older versions? Learn more.
MeshTrace (beta)
This policy uses new policy matching algorithm and is in beta state, it should not be mixed with TrafficTrace.
This policy enables publishing traces to a third party tracing solution.
Tracing is supported over HTTP, HTTP2, and gRPC protocols. You must explicitly specify the protocol for each service and data plane proxy you want to enable tracing for.
Kuma currently supports the following trace exposition formats:
zipkin
traces in this format can be sent to many different tracing backendsdatadog
Services still need to be instrumented to preserve the trace chain across requests made across different services.
You can instrument with a language library of your choice (for zipkin and for datadog). For HTTP you can also manually forward the following headers:
x-request-id
x-b3-traceid
x-b3-parentspanid
x-b3-spanid
x-b3-sampled
x-b3-flags
TargetRef support matrix
TargetRef type | top level | to | from |
---|---|---|---|
Mesh | ✅ | ❌ | ❌ |
MeshSubset | ✅ | ❌ | ❌ |
MeshService | ✅ | ❌ | ❌ |
MeshServiceSubset | ✅ | ❌ | ❌ |
MeshGatewayRoute | ✅ | ❌ | ❌ |
To learn more about the information in this table, see the matching docs.
Configuration
Sampling
Most of the time setting only overall
is sufficient. random
and client
are for advanced use cases.
You can configure sampling settings equivalent to Envoy’s:
The value is always a percentage and is between 0 and 100.
Example:
Tags
You can add tags to trace metadata by directly supplying the value (literal
) or by taking it from a header (header
).
Example:
If a value is missing for header
, default
is used.
If default
isn’t provided, then the tag won’t be added.
Backends
Datadog
You can configure a Datadog backend with a url
and splitService
.
Example:
The splitService
property determines if Datadog service names should be split based on traffic direction and destination.
For example, with splitService: true
and a backend
service that communicates with a couple of databases,
you would get service names like backend_INBOUND
, backend_OUTBOUND_db1
, and backend_OUTBOUND_db2
in Datadog.
Zipkin
In most cases the only field you’ll want to set in url
.
Example:
Examples
Zipkin
Simple example:
Full example:
Apply the configuration with kubectl apply -f [..]
.
Datadog
This assumes a Datadog agent is configured and running. If you haven’t already check the Datadog observability page.
Simple Example:
Full Example:
where trace-svc
is the name of the Kubernetes Service you specified when you configured the Datadog APM agent.
Apply the configuration with kubectl apply -f [..]
.
Targeting parts of the infrastructure
While usually you want all the traces to be sent to the same tracing backend,
you can target parts of a Mesh
by using a finer-grained targetRef
and a designated backend to trace different paths of our service traffic.
This is especially useful when you want traces to never leave a world region, or a cloud, for example.
In this example, we have two zones east
and west
, each of these with their own Zipkin collector: east.zipkincollector:9411/api/v2/spans
and west.zipkincollector:9411/api/v2/spans
.
We want dataplane proxies in each zone to only send traces to their local collector.
To do this, we use a TargetRef
kind value of MeshSubset
to filter which dataplane proxy a policy applies to.
West only policy:
East only policy: