Repository navigation
Avoid copying Activity tags and links when sampling - #135277
Conversation
Do not copy links and tags when creating a new `Activity` when `ActivitySamplingResult.PropagationData` is specified. Fixes dotnet#135007.
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-diagnostics-tracing |
|
Tagging subscribers to this area: @dotnet/area-system-diagnostics-activity |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Sampler tags violate their documented contract, and the behavioral change needs compatibility documentation.
Review effort: Balanced
Findings: 1
What changed in this PR
Optimizes Activity creation for PropagationData sampling.
Changes:
- Skips copying creation tags, links, and sampler tags.
- Adds coverage for parent formats and multiple listeners.
| File | Description |
|---|---|
Activity.cs |
Conditionally skips data copying. |
ActivitySourceTests.cs |
Tests the revised sampling behavior. |
- Harden check for skipping tags. - Don't skip sampler tags.
Update `ActivitySource,CreateActivity()` parameter documentation for `tags` and `links` for new behaviour.
|
Added When you commit this breaking change:
Tagging @dotnet/compat for awareness of the breaking change. |
Breaking Change DocumentationA breaking change draft has been prepared for this PR. 👉 Click here to create the issue in dotnet/docs After creating the issue, please email a link to it to the Note This documentation was generated with AI assistance from Copilot.
|
|
Breaking change issue dotnet/docs#56340 is filed. |
## Summary Fix the breaking-change documentation workflow completing successfully without publishing its generated comment. This occurred after #135277 merged: [workflow run 37654155119](https://github.com/dotnet/runtime/actions/runs/37654155119) generated draft artifacts but published no comment. Required shell commands were denied, and the incomplete outcome did not fail the workflow. ## Changes - Configure one default shallow checkout so the required helper scripts are available, retaining the trusted base context for `pull_request_target` without checking out the same repository twice. - Allow the required `jq` and `mkdir` commands without granting unrestricted shell access. - Require the existing version and comment-building helpers, and submit the complete comment through a single-command safe-output invocation. - Expose the effective dry-run mode in the rendered prompt, with a `false` fallback for automatic PR events. - Validate the outcome, PR destination, complete draft pair, and raw comment body against `pr-comment.md`. Preserve valid early no-ops and dry runs, while rejecting incomplete generation and publication failures. - Prevent publication unless the generation job succeeds. - Regenerate the lock file with gh-aw v0.86.2. ## Validation - Strict compilation and schema validation passed for the submitted workflow: ```powershell gh aw compile breaking-change-doc --schedule-seed dotnet/runtime --no-check-update --strict --validate --no-emit ``` - All 58 session-local regression checks passed, covering the original failed-run output, numeric and string PR identifiers, raw comment-body binding, dry runs, no-op handling, failed-generation publication gating, and single trusted checkout behavior. Seven cases use the exact pinned workflow renderer to verify the effective mode for manual and automatic events. The test snapshot matches both workflow files. These checks are not included in this PR or wired into repository CI. - Targeted Markdownlint passed for `.github/workflows/breaking-change-doc.md`. - `git diff --check` passed. ## Live validation An [initial dry run](https://github.com/dotnet/runtime/actions/runs/37688137969) exposed that the selected dry-run mode was not supplied to the rendered prompt. The validator rejected a comment intent and the publication gate blocked posting. This led to the explicit mode-propagation correction. A [corrected dry run](https://github.com/dotnet/runtime/actions/runs/37690925971) passed on commit `73ea0d33b02` against #135277 with `suppress_output=true`. The prompt explicitly contained `true`, both complete documentation artifacts were generated, and the outcome was exactly one `noop` with no publication intent. All jobs passed and the source PR's four comment IDs remained unchanged. Commit `4db4d8311d9` addresses the checkout review comment by using the default checkout configuration. The generated agent job now has one repository checkout with `persist-credentials: false` and `fetch-depth: 1`. The review thread is resolved. A [final-commit dry run](https://github.com/dotnet/runtime/actions/runs/37694130479) passed against #135277 with `suppress_output=true`. The single checkout succeeded, both complete draft artifacts were generated, and the raw and ingested outcomes were exactly one `noop`. All seven jobs passed, and the source PR's four comment IDs remained unchanged. A [publication-enabled run](https://github.com/dotnet/runtime/actions/runs/37695040898) passed on the same final commit with `suppress_output=false`. All seven jobs, outcome validation, and the publication gate passed. Exactly one raw `add_comment` intent targeted #135277 and matched the complete helper-generated comment before sanitization. The workflow actually [posted the documentation comment](#135277 (comment)) as `github-actions[bot]`. The source PR's comment count increased from four to five. The published comment was checked to contain the ingested safe-output body and the complete issue draft in its prefilled issue link. No dotnet/docs issue was created. ## Scope and limitations This PR remains a draft. Manual dry-run generation and actual comment publication are verified on the final commit; the automatic merge/label trigger was not exercised by these manual dispatches. The version helper is invoked, but the sandbox's unauthenticated `gh` dependency requires its documented metadata fallback. An independent authenticated local execution confirmed `.NET 12 Preview 1` with `Tentative=false` and no backports, matching the generated documentation. This PR does not grant additional GitHub credentials. PR CI passed Markdownlint, but it does not exercise this workflow's generation/publication path or the session-local regression checks. The main runtime build/test pipelines exclude these `.github`-only changes. --------- Co-authored-by: Tarek Mahmoud Sayed <tarekms@ntdev.microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Do not copy links and tags when creating a new
ActivitywhenActivitySamplingResult.PropagationDatais specified.Fixes #135007.
Benchmarks
BenchmarkDotNet, default job,
--inProcess --affinity 4095, creating, starting and stopping an activity with the listener returning the given sampling result.mainvs. PR; the tag set is the 9 tags ASP.NET Core-style server instrumentation passes at creation, plus one link. Ratios are PR / main (lower is better).PropagationDataNoTagsPropagationDataNineTagsPropagationDataNineTagsAndLinkAllDataAndRecordedNoTagsAllDataAndRecordedNineTagsAllDataAndRecordedNineTagsAndLinkBenchmark Code