Include AvailabilityTelemetry.Timestamp as microsoft.availability.testTimestamp attribute#3153
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 <[email protected]>
|
@copilot Add changelog update |
Agent-Logs-Url: https://github.com/microsoft/ApplicationInsights-dotnet/sessions/75a63958-f27f-48e5-bade-7bbeb08ea0b7 Co-authored-by: rajkumar-rangaraj <[email protected]>
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 <[email protected]>
|
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:
|
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.