Include AvailabilityTelemetry.Timestamp as microsoft.availability.testTimestamp attribute#3153
Merged
rajkumar-rangaraj merged 4 commits intomainfrom Mar 27, 2026
Conversation
…tTimestamp attribute When TrackAvailability is called, the Timestamp property from AvailabilityTelemetry is now included as a microsoft.availability.testTimestamp attribute in ISO 8601 format. This allows downstream exporters (e.g. Azure Monitor) to use the user-specified timestamp as the event time instead of the log record creation time. The attribute is omitted when Timestamp is default. Fixes #3152 Agent-Logs-Url: https://github.com/microsoft/ApplicationInsights-dotnet/sessions/a2c48a2d-4b7c-4088-8fa0-901d9226ea88 Co-authored-by: rajkumar-rangaraj <9479006+rajkumar-rangaraj@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix timestamp on AvailabilityTelemetry in TelemetryClient
Include AvailabilityTelemetry.Timestamp as microsoft.availability.testTimestamp attribute
Mar 27, 2026
Member
|
@copilot Add changelog update |
Agent-Logs-Url: https://github.com/microsoft/ApplicationInsights-dotnet/sessions/75a63958-f27f-48e5-bade-7bbeb08ea0b7 Co-authored-by: rajkumar-rangaraj <9479006+rajkumar-rangaraj@users.noreply.github.com>
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures TrackAvailability preserves a user-provided AvailabilityTelemetry.Timestamp by emitting it as a microsoft.availability.testTimestamp log attribute (ISO 8601), enabling downstream exporters to reconstruct the correct event time for availability tests.
Changes:
- Add
microsoft.availability.testTimestampattribute whenAvailabilityTelemetry.Timestamp != default. - Extend existing availability tests to assert timestamp propagation.
- Add new tests to validate timestamp presence/absence for explicit vs default timestamps.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| BASE/src/Microsoft.ApplicationInsights/TelemetryClient.cs | Adds emission of microsoft.availability.testTimestamp from AvailabilityTelemetry.Timestamp when set. |
| BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/TelemetryClientTest.cs | Adds/extends tests to verify timestamp is included when provided and omitted when default. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/microsoft/ApplicationInsights-dotnet/sessions/2847601f-8eaf-42ea-9083-9933f8230ab3 Co-authored-by: rajkumar-rangaraj <9479006+rajkumar-rangaraj@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
9 tasks
rajkumar-rangaraj
approved these changes
Mar 27, 2026
harsimar
approved these changes
Mar 27, 2026
This was referenced Apr 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TrackAvailabilitydrops the user-providedTimestampfromAvailabilityTelemetry. The log record is emitted with the current wall-clock time, breaking end-to-end transaction timelines where the availability test start time precedes dependent HTTP calls.Changes
TelemetryClient.cs— Emitmicrosoft.availability.testTimestamp(ISO 8601 UTC) in the properties dictionary whenTimestamp != default, usingTimestamp.UtcDateTimeto normalize to UTC. Consistent with the existingmicrosoft.availability.*attribute contract. Downstream exporters can use this to set the correct event time.TelemetryClientTest.cs— Added timestamp assertion to two existing tests; addedTrackAvailabilityPreservesUserSpecifiedTimestampandTrackAvailabilityOmitsTimestampWhenDefault.CHANGELOG.md— Added entry under Unreleased.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.