Page MenuHomePhabricator

Micro-specification for how service owners should propagate tracing headers
Open, Needs TriagePublic

Description

longer writeup to-do, but, tldr: it's perhaps undesirable to (at least initially) force lots of things to depend on the OpenTelemetry libraries just for context propagation, when we could instead have a list of headers to copy from incoming requests (if present) to outgoing sub-requests

Event Timeline

Would also like some guidance for how to pass on this info in emitted data events. We already produce the request_id, but perhaps we can make a more standardized tracing schema fragment for this.

Would also like some guidance for how to pass on this info in emitted data events. We already produce the request_id, but perhaps we can make a more standardized tracing schema fragment for this.

I agree with this, it should be a reusable fragment for events, probably a versioned one (it's possible we add more fields in the future).

In Mediawiki core we now have Wikimedia/Http/TelemetryHeadersInterface, which although doesn't provide a data model, allows for pluggable implementations that extract the necessary headers, and currently only has one implementation: https://gerrit.wikimedia.org/g/mediawiki/core/+/master/includes/http/Telemetry.php

It seems like a reasonable idea to add to that interface a way to extract the same telemetry context as a fragment for events.

There is a quick way already - Telemetry::getRequestHeaders().

You can find it used across MediaWiki, for example:

The idea is - wherever you send a request, call Telemetry::getInstance()->getRequestHeaders() and inject those into the request you're sending.

Currently, this will only fully propagate or generate the X-Request-Id and only propagate 'tracestate', 'traceparent' . To create new spans we would need a library. @mszabo is working on a POC of lightweight lib that would allow us to create new spans.

There is a quick way already - Telemetry::getRequestHeaders().

Yep -- my link above is RFC, not code -- although it does reference Telemetry::getInstance()->getRequestHeaders() :)