Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Resolves #2505 Given a traceparent header like 00-00000000000000001b3ef83a5d15ed1b-61409d351b3a5d99-01, jaeger will store (and thus display + interpolate) the trace ID as 1b3ef83a5d15ed1b. When attempting to use the shortened trace ID to link to logs some tracing integrations (in my case, logs using [pino](https://www.npmjs.com/package/pino) instrumented with the [OpenTelemetry pino instrumentation](https://www.npmjs.com/package/@opentelemetry/instrumentation-pino)) will use the full length trace ID, making jaeger link patterns not work. This PR adds a `pad_start` formatting function, heavily inspired by javascript's [String.padStart](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) to format the trace ID in those cases. If approved, I'll update the documentation in https://github.com/jaegertracing/documentation to mention this function and it's behavior. In addition to this specific function, I'd like feedback on the approach of passing arguments to formatting functions with the space-delimited approach (eg `#{traceID | padStart 32 0}`). # How was this change tested? Unit tests and by running it locally with the following UI config ``` const DEFAULT_CONFIG = { "linkPatterns": [ { "type": "traces", "url": "https://myOpenSearch.com/_dashboards/app/discover#/?_g=(time:(from:'#{startTime | epoch_micros_to_date_iso}',to:'#{endTime | epoch_micros_to_date_iso}'))&_a=(columns:!(_source),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:filebeat-all,key:json.traceId,negate:!f,params:(query:'#{traceID | pad_start 32 0}'),type:phrase),query:(match_phrase:(json.traceId:'#{traceID | pad_start 32 0}')))),index:filebeat-all)", "text": "Logs" } ] }; ``` Signed-off-by: Drew Corlin <drew.corlin@getgarner.com>
- Loading branch information