<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/fixing-broken-traces-in-gcp-cloud-run-a-custom-opentelemetry-propagator-2kwtpexct" -->

---
title: Fixing Broken Traces in GCP Cloud Run: A Custom...
description: GCP&#x27;s load balancer silently rewrites the W3C `traceparent` header when requests pass between Cloud Run services, inserting its own span that only exists in...
canonical: https://daily.dev/posts/fixing-broken-traces-in-gcp-cloud-run-a-custom-opentelemetry-propagator-2kwtpexct
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Fixing Broken Traces in GCP Cloud Run: A Custom OpenTelemetry Propagator | daily.dev
og:description: GCP&#x27;s load balancer silently rewrites the W3C `traceparent` header when requests pass between Cloud Run services, inserting its own span that only exists in...
og:url: https://daily.dev/posts/fixing-broken-traces-in-gcp-cloud-run-a-custom-opentelemetry-propagator-2kwtpexct
og:image: https://api.daily.dev/og/posts/2kWTPexct.png
og:image:alt: Fixing Broken Traces in GCP Cloud Run: A Custom OpenTelemetry Propagator
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Fixing Broken Traces in GCP Cloud Run: A Custom OpenTelemetry Propagator

**[Last9](https://daily.dev/sources/last9)** · 6 min read · 0 upvotes · 0 comments

## Summary

GCP's load balancer silently rewrites the W3C `traceparent` header when requests pass between Cloud Run services, inserting its own span that only exists in Google Cloud Trace. This orphans spans in any OTLP backend, breaking parent-child relationships in distributed traces. The fix is a custom `CloudRunTracePropagator` that copies the original `traceparent` into a backup header (`x-original-traceparent`) before the load balancer can modify it. On the receiving side, the propagator reads the backup header to restore the correct parent context. Full Node.js implementation and SDK wiring are provided, along with deployment notes for Cloud Run Functions using `NODE_OPTIONS`.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://last9.io/blog/gcp-cloud-run-trace-propagation>

## Similar posts on daily.dev

- [A practical guide to solving when zero\+zero=two in mesh observability](https://daily.dev/posts/a-practical-guide-to-solving-when-zero-zero-two-in-mesh-observability-ilh2ezusu) · CNCF · 1 upvotes · 0 comments
- [Trace Google Pub/Sub workloads in Cloud Run with Datadog](https://daily.dev/posts/trace-google-pub-sub-workloads-in-cloud-run-with-datadog-xpedyb7vb) · Datadog · 1 upvotes · 0 comments

---

Tags: [#devops](https://daily.dev/tags/devops), [#nodejs](https://daily.dev/tags/nodejs), [#opentelemetry](https://daily.dev/tags/opentelemetry)

[View this post on daily.dev](https://daily.dev/posts/fixing-broken-traces-in-gcp-cloud-run-a-custom-opentelemetry-propagator-2kwtpexct)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Fixing Broken Traces in GCP Cloud Run: A Custom OpenTelemetry Propagator","url":"https://daily.dev/posts/fixing-broken-traces-in-gcp-cloud-run-a-custom-opentelemetry-propagator-2kwtpexct","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/fixing-broken-traces-in-gcp-cloud-run-a-custom-opentelemetry-propagator-2kwtpexct"},"datePublished":"2026-04-24T09:23:35.073Z","dateModified":"2026-04-24T09:23:56.316Z","description":"GCP's load balancer silently rewrites the W3C `traceparent` header when requests pass between Cloud Run services, inserting its own span that only exists in...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6eb3e243a1de6babee189e9815bdcd7a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6eb3e243a1de6babee189e9815bdcd7a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Last9","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Last9","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/0542036d401f4cb1885680f1984fb880","url":"https://daily.dev/sources/last9"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/fixing-broken-traces-in-gcp-cloud-run-a-custom-opentelemetry-propagator-2kwtpexct","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"devops,nodejs,opentelemetry","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Last9","item":"https://daily.dev/sources/last9"},{"@type":"ListItem","position":3,"name":"Fixing Broken Traces in GCP Cloud Run: A Custom OpenTelemetry Propagator"}]}
```

