Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy the traceparent header between calls to show how tracing works across multiple API calls #650

Open
msfussell opened this issue Apr 15, 2022 · 1 comment
Labels
good first issue Good for newcomers P1

Comments

@msfussell
Copy link
Member

This is for updating the Hello-World and Hello-Kubernetes quickstarts to show tracing across two independent API calls. A small change in the Node application can show this end to end by copying the trace header as shown below.

app.post('/neworder', (req, res) => {
    const data = req.body.data;
    const traceparent = req.headers.traceparent;
    const orderId = data.orderId;
    console.log("Got a new order! Order ID: " + orderId + " traceparent: " + traceparent);

    const state = [{
        key: "order",
        value: data
    }];

    fetch(stateUrl, {
        method: "POST",
        body: JSON.stringify(state),
        headers: {
            "Content-Type": "application/json",
            "traceparent": traceparent  //copy the traceparent header from the incoming request to trace the call to state management API
        }
    }).then((response) => {
        if (!response.ok) {
            throw "Failed to persist state.";
        }


Then instead of this

image

you get this for zipkin tracing.

image

This will work for both self hosted and K8s. At the same time it is worth updating the Observability Tutorial to show this end to end tracing since this not that well described in the docs today.

@sicoyle
Copy link

sicoyle commented Sep 18, 2023

Need to audit the docs and add a section on how to propagate the headers for tracing. Add code samples to docs.

Could add quickstarts example that shows how to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers P1
Projects
No open projects
Development

No branches or pull requests

3 participants