Skip to content

tracing: Expose CEL config on tracing for HCM and routes #45447

Description

@kamalmarhubi

I would like access to configured formatter extensions in tracing fields that already support substitution formatters. The specific use case is to use %CEL(...)% with CEL string functions in trace custom tags or operation names, but the CEL string extensions are not available in that context, and as far as I can tell they can't be enabled.

This is similar to #45420, and some of the content below is basically copy-pasted from that issue.

The relevant tracing fields I'm aware of:

  • HttpConnectionManager.Tracing.custom_tags.value, operation, and upstream_operation
  • route Tracing.custom_tags.value, operation, and upstream_operation

Possible API shape would be to add a formatters config on the HCM's tracing type

 message Tracing {
   [...]
   bool no_context_propagation = 13;
+
+  // Formatter command parsers used for tracing custom tags and operation names.
+  // [#extension-category: envoy.formatter]
+  repeated config.core.v3.TypedExtensionConfig formatters = 14;
 }

and the same on route tracing

This would also need extensions.formatter.cel.v3.Cel to get an optional CelExpressionConfig so that this can actually be configured, as in #45420.

Alternative API placements:

  • CelExpressionConfig instead of repeated envoy.formatter TypedExtensionConfigs
    • this would be simpler for CEL, but less general in case any formatters grew options or if new ones were added
  • placing the config on type.tracing.v3.CustomTag
    • this would cover only custom tags, not operation or upstream_operation
    • CustomTag is also reused by the gRPC and otel access loggers, where formatter command parsers are already part of the access logger plumbing, so there would be some weird redundancy in there
  • only adding the field on HCM tracing and letting routes inherit it
    • this would be simpler, but route config is its own resource and may need to validate/compile independently
    • it also seems useful for per-route tracing config to be able to use a different formatter/CEL policy from the HCM default

I don't know if there are other bits of the tracing machinery, but the intent would be that every formatter-backed value allows this customisation.

Relevant Links:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions