Skip to content

JMS instrumentation #584

@codefromthecrypt

Description

@codefromthecrypt

There's an indirect requirement for JMS instrumentation through spring-cloud-sleuth. Besides the multiple versions of JMS apis, there's an important concern with propagation due to naming constraints which exist in JMS, but not necessarily in the underlying transport.

JMS requires that message header names follow java naming conventions. Notably this excludes hyphens and dots. For example, in Camel, there's a naming policy to map to and from these constraints.

For example, many simply downcase B3 headers to x-b3-traceid for use in non-http transports (which might not be case insensitive). In JMS, this wouldn't work, even if rabbitmq is used underneath which has no such constraint. Ex, if using camel JMS, this header would map into x_HYPHEN_b3_HYPHEN_traceid.

In some cases, JMS headers are replaced based on constants or other patterns, like globally replacing hyphens with underscores. Interestingly opentracing decided on a different pattern _$dash$_, though they have no pattern for dots: For example, if you were using the OT library and camel on the other, you'd get x_HYPHEN_b3_HYPHEN_traceid on one side and x_$dash$_b3_$dash$_traceid on the other, mutually unreadable.

The universal implication of using JMS is that it implies global coordination of these naming patterns, or there will be propagation incompatibility (ex traces will restart). This will also break anything else propagated that isn't a trace ID. This type of problem has already been noticed in early users of message tracing.

Importantly, even if we were to have static replacements for B3, we don't know if users will introduce propagated headers with dots or hyphens in them. In other words, I don't think a solution to this problem can be constant in nature, though constants could help.

Challenge here is to introduce support for JMS propagation, but without assuming we are using B3 format, and ideally inheriting a naming convention as opposed to introducing another dimension of naming convention complexity for others. Coming up with a sane default might be particularly tricky.

Calling for advice from @davsclaus @garyrussell @Xylus @jkowall @christian-schwarzbauer @CodingFabian (others feel free to contribute too!)

See also discussion on w3c trace context https://github.com/w3c/distributed-tracing/issues/35

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions