Skip to content

tracing: Make request id format and tracing behavior configurable #7624

@euroelessar

Description

@euroelessar

Description:
Envoy currently enforces specific format of x-request-id header, and piggybacks tracing decisions into it.
However this approach does not play well with existing setups, which already heavily use both request ids and tracing, and rely on transmission of this data in different form (e.g. using explicit distinct headers for tracing-related metadata).

In short we would like to have an ability to use Envoy's tracing configuration (sample ratio, x-force-tracing header, skipping health checks, statistics, etc) with different data format.

Is it reasonable to make this behavior configurable, e.g. by ability to create native extensions which would override behavior of Envoy::UuidUtils?

Relevant Links:

UuidTraceStatus UuidUtils::isTraceableUuid(absl::string_view uuid) {
if (uuid.length() != Runtime::RandomGeneratorImpl::UUID_LENGTH) {
return UuidTraceStatus::NoTrace;
}
switch (uuid[TRACE_BYTE_POSITION]) {
case TRACE_FORCED:
return UuidTraceStatus::Forced;
case TRACE_SAMPLED:
return UuidTraceStatus::Sampled;
case TRACE_CLIENT:
return UuidTraceStatus::Client;
default:
return UuidTraceStatus::NoTrace;
}
}

bool UuidUtils::setTraceableUuid(std::string& uuid, UuidTraceStatus trace_status) {
if (uuid.length() != Runtime::RandomGeneratorImpl::UUID_LENGTH) {
return false;
}
switch (trace_status) {
case UuidTraceStatus::Forced:
uuid[TRACE_BYTE_POSITION] = TRACE_FORCED;
break;
case UuidTraceStatus::Client:
uuid[TRACE_BYTE_POSITION] = TRACE_CLIENT;
break;
case UuidTraceStatus::Sampled:
uuid[TRACE_BYTE_POSITION] = TRACE_SAMPLED;
break;
case UuidTraceStatus::NoTrace:
uuid[TRACE_BYTE_POSITION] = NO_TRACE;
break;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    design proposalNeeds design doc/proposal before implementationenhancementFeature requests. Not bugs or questions.help wantedNeeds help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions