Skip to content

Commit d5e8dd9

Browse files
author
Cam Soper
committed
issue 44282
1 parent df37114 commit d5e8dd9

File tree

4 files changed

+69
-4
lines changed

4 files changed

+69
-4
lines changed

docs/core/compatibility/10.0.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
1717
1818
## Core .NET libraries
1919

20-
| Title | Type of change | Introduced version |
21-
|------------------------------------------------------------------------------------------|---------------------|--------------------|
22-
| [API obsoletions with non-default diagnostic IDs](core-libraries/10.0/obsolete-apis.md) | Source incompatible | Preview 1 |
20+
| Title | Type of change | Introduced version |
21+
|----------------------------------------------------------------------------------------------------------------------------|---------------------|--------------------|
22+
| [API obsoletions with non-default diagnostic IDs](core-libraries/10.0/obsolete-apis.md) | Source incompatible | Preview 1 |
23+
| [ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change](core-libraries/10.0/activity-sampling.md) | Behavioral change | Preview 1 |
2324

2425
## Windows Forms
2526

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: "Breaking change: ActivitySource.CreateActivity and ActivitySource.StartActivity behavior changes"
3+
description: Learn about the .NET 10.0 breaking change in core .NET libraries where ActivitySource.CreateActivity and ActivitySource.StartActivity behavior is modified.
4+
ms.date: 01/30/2025
5+
---
6+
# ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change
7+
8+
The <xref:System.Diagnostics.ActivitySource.CreateActivity*?displayProperty=nameWithType> and <xref:System.Diagnostics.ActivitySource.StartActivity*?displayProperty=nameWithType> APIs only return an `Activity` when there is a registered listener which decides the instance should be created. This is generally known as sampling.
9+
10+
The <xref:System.Diagnostics.ActivitySamplingResult?displayProperty=nameWithType> enum defines the possible sampling decisions.
11+
12+
When creating an `Activity` without a parent, `ActivitySamplingResult` drives whether the `Activity` is created and then how the `Recorded` and `IsAllDataRequested` properties are set:
13+
14+
|ActivitySamplingResult|Activity created|Activity.Recorded|Activity.IsAllDataRequested|
15+
|---|---|---|---|
16+
|None|No|||
17+
|PropagationData|Yes|False|False|
18+
|AllData|Yes|False|True|
19+
|AllDataAndRecorded|Yes|True|True|
20+
21+
It is also possible to create an `Activity` with a parent. The parent could be in the same process, or it could be a remote parent propagated to the current process.
22+
23+
## Previous behavior
24+
25+
When creating an `Activity` as `PropagationData` with a parent marked as `Recorded`:
26+
27+
|ActivitySamplingResult|Activity created|Activity.Recorded|Activity.IsAllDataRequested|
28+
|---|---|---|---|
29+
|PropagationData|Yes|True|False|
30+
31+
## New behavior
32+
33+
When creating an `Activity` as `PropagationData` with a parent marked as `Recorded`:
34+
35+
|ActivitySamplingResult|Activity created|Activity.Recorded|Activity.IsAllDataRequested|
36+
|---|---|---|---|
37+
|PropagationData|Yes|False|False|
38+
39+
## Version introduced
40+
41+
.NET 10 Preview 1
42+
43+
## Type of breaking change
44+
45+
This change is a [behavioral change](../../categories.md#behavioral-change).
46+
47+
## Reason for change
48+
49+
The existing behavior does not follow the OpenTelemetry specification.
50+
51+
## Recommended action
52+
53+
Users who have implemented `ActivityListener.Sample` directly AND use `ActivitySamplingResult.PropagationData` should verify they are not reliant on the flawed behavior. `Activity.ActivityTraceFlags` may be set to `Recorded` after the `CreateActivity` or `StartActivity` call to restore the previous behavior.
54+
55+
Users using OpenTelemetry .NET should verify their sampler configuration. The default OpenTelemetry .NET configuration uses a parent-based algorithm which is not impacted. Only users who have customized the sampler should verify the behavior.
56+
57+
## Affected APIs
58+
59+
- <xref:System.Diagnostics.ActivitySource.CreateActivity?displayProperty=fullName>
60+
- <xref:System.Diagnostics.ActivitySource.StartActivity?displayProperty=fullName>

docs/core/compatibility/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ items:
1212
items:
1313
- name: API obsoletions with non-default diagnostic IDs
1414
href: core-libraries/10.0/obsolete-apis.md
15+
- name: ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change
16+
href: core-libraries/10.0/activity-sampling.md
1517
- name: Windows Forms
1618
items:
1719
- name: TreeView checkbox image truncation
@@ -1316,6 +1318,8 @@ items:
13161318
items:
13171319
- name: API obsoletions with non-default diagnostic IDs
13181320
href: core-libraries/10.0/obsolete-apis.md
1321+
- name: ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change
1322+
href: core-libraries/10.0/activity-sampling.md
13191323
- name: .NET 9
13201324
items:
13211325
- name: Adding a ZipArchiveEntry sets header general-purpose bit flags

docs/fundamentals/syslib-diagnostics/syslib0060.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: SYSLIB0060 warning - Rfc2898DeriveBytes constructors are obsolete
33
description: Learn about the obsoletion of Rfc2898DeriveBytes constructors. Use of these constructors generates compile-time warning SYSLIB0060.
4-
ms.date: 01/01/2025
4+
ms.date: 01/30/2025
55
f1_keywords:
66
- SYSLIB0060
77
---

0 commit comments

Comments
 (0)