Skip to content

Conversation

philipphofmann
Copy link
Member

@philipphofmann philipphofmann commented Oct 6, 2025

📜 Description

Added support for OTel/W3C trace propagation by introducing a new option enablePropagateTraceparent that controls whether the SDK adds the W3C traceparent HTTP header to outgoing requests.

Docs PR getsentry/sentry-docs#15159

💡 Motivation and Context

Fixes GH-6017

💚 How did you test it?

Added unit tests to verify the traceparent header is correctly added when the feature is enabled and not added when disabled. Also tested that existing headers aren't overridden.

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

Copy link
Member Author

philipphofmann commented Oct 6, 2025

Copy link
Contributor

github-actions bot commented Oct 6, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against ba85c3b

@philipphofmann philipphofmann marked this pull request as ready for review October 6, 2025 09:06
cursor[bot]

This comment was marked as outdated.

@philipphofmann philipphofmann self-assigned this Oct 6, 2025
@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch 3 times, most recently from 957c698 to 7658828 Compare October 6, 2025 09:13
@philipphofmann philipphofmann marked this pull request as draft October 6, 2025 09:14
cursor[bot]

This comment was marked as outdated.

@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch 2 times, most recently from 08b8399 to e059998 Compare October 6, 2025 09:24
@philipphofmann philipphofmann marked this pull request as ready for review October 6, 2025 09:24
cursor[bot]

This comment was marked as outdated.

@philipphofmann philipphofmann marked this pull request as draft October 6, 2025 09:27
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@c1254d8). Learn more about missing BASE report.

Files with missing lines Patch % Lines
Sources/Sentry/SentryTracePropagation.m 81.818% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main     #6356   +/-   ##
========================================
  Coverage        ?   86.865%           
========================================
  Files           ?       441           
  Lines           ?     37277           
  Branches        ?     17345           
========================================
  Hits            ?     32381           
  Misses          ?      4855           
  Partials        ?        41           
Files with missing lines Coverage Δ
Sources/Sentry/SentryNetworkTracker.m 99.732% <100.000%> (ø)
Sources/Sentry/SentryOptions.m 97.241% <100.000%> (ø)
Sources/Sentry/SentyOptionsInternal.m 99.671% <100.000%> (ø)
Sources/Sentry/SentryTracePropagation.m 84.931% <81.818%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1254d8...ba85c3b. Read the comment docs.

Copy link
Contributor

github-actions bot commented Oct 6, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1219.76 ms 1255.91 ms 36.16 ms
Size 23.75 KiB 995.62 KiB 971.87 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
fc05805 1220.63 ms 1252.16 ms 31.54 ms
b9aacb6 1230.42 ms 1251.00 ms 20.58 ms
d8b2303 1231.53 ms 1249.89 ms 18.35 ms
1339919 1214.82 ms 1238.98 ms 24.16 ms
ac4739e 1236.55 ms 1258.89 ms 22.34 ms
b714cb9 1224.71 ms 1238.04 ms 13.33 ms
d157d83 1228.02 ms 1252.47 ms 24.45 ms
aff3b66 1229.53 ms 1263.08 ms 33.55 ms
7d88965 1228.86 ms 1248.53 ms 19.67 ms
30f4e4c 1213.21 ms 1250.29 ms 37.08 ms

App size

Revision Plain With Sentry Diff
fc05805 23.75 KiB 908.02 KiB 884.27 KiB
b9aacb6 23.75 KiB 913.64 KiB 889.89 KiB
d8b2303 23.75 KiB 908.02 KiB 884.27 KiB
1339919 23.75 KiB 919.70 KiB 895.95 KiB
ac4739e 23.75 KiB 872.67 KiB 848.92 KiB
b714cb9 23.75 KiB 858.69 KiB 834.93 KiB
d157d83 23.75 KiB 928.85 KiB 905.10 KiB
aff3b66 23.75 KiB 978.53 KiB 954.78 KiB
7d88965 23.75 KiB 994.72 KiB 970.98 KiB
30f4e4c 23.75 KiB 879.24 KiB 855.50 KiB

Previous results on branch: feat_add_propagating_of_traceparent

Startup times

Revision Plain With Sentry Diff
fec69f5 1233.02 ms 1266.88 ms 33.85 ms
1c5ce84 1219.49 ms 1249.06 ms 29.57 ms
fe4d5d5 1237.80 ms 1253.33 ms 15.53 ms
786f095 1231.33 ms 1261.23 ms 29.90 ms
dea0f9c 1227.83 ms 1262.15 ms 34.32 ms

App size

Revision Plain With Sentry Diff
fec69f5 23.75 KiB 987.44 KiB 963.69 KiB
1c5ce84 23.75 KiB 987.45 KiB 963.70 KiB
fe4d5d5 23.75 KiB 990.49 KiB 966.74 KiB
786f095 23.75 KiB 988.54 KiB 964.80 KiB
dea0f9c 23.75 KiB 990.65 KiB 966.90 KiB

@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch 2 times, most recently from 81880fc to 532f4d6 Compare October 6, 2025 11:20
@philipphofmann philipphofmann marked this pull request as ready for review October 6, 2025 11:20
@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch 2 times, most recently from 88a830e to 532f4d6 Compare October 8, 2025 02:44
cursor[bot]

This comment was marked as outdated.

@philipphofmann philipphofmann force-pushed the ref_remove_sentrysdk_from_trace_propagation_class branch from 3f3c1fe to 750199d Compare October 8, 2025 02:50
@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch from 532f4d6 to 8203702 Compare October 8, 2025 02:50
cursor[bot]

This comment was marked as outdated.

@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch from 8203702 to 932a47c Compare October 8, 2025 02:55
@noahsmartin
Copy link
Contributor

It looks like you might have ran the api file generation using Xcode 26, CI uses 16.4 so it won't pass CI unless you use that. This was because Xcode 26 doesn't include the objc public API (only Swift)

@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch from 932a47c to 17322cb Compare October 8, 2025 05:10
@philipphofmann philipphofmann force-pushed the ref_remove_sentrysdk_from_trace_propagation_class branch from 750199d to 8f2d7b7 Compare October 8, 2025 05:10
cursor[bot]

This comment was marked as outdated.

@philipphofmann philipphofmann force-pushed the ref_remove_sentrysdk_from_trace_propagation_class branch 2 times, most recently from a48560a to a3dc1e0 Compare October 8, 2025 05:48
Base automatically changed from ref_remove_sentrysdk_from_trace_propagation_class to main October 10, 2025 03:57
@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch from 17322cb to ae307fd Compare October 10, 2025 04:02
Add the option propagateTraceparent, which is disabled by default. When
enabled, it adds the W3C Trace Context HTTP header traceparent on
outgoing HTTP requests. This is useful when the receiving services only
support OTel/W3C propagation.

Fixes GH-6017
@philipphofmann philipphofmann force-pushed the feat_add_propagating_of_traceparent branch from ae307fd to 3e7817b Compare October 10, 2025 04:07
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • Sources/Sentry/SentryNetworkTracker.m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add traceparent support to sentry-cocoa

2 participants