Updating Missing Telemetry#48978
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Spring Cloud Azure App Configuration’s correlation-context/tracing telemetry to include additional supported feature signals (e.g., load balancing, AI profiles, feature flag metadata) and wires TracingInfo through replica clients so request policies can emit the updated telemetry.
Changes:
- Extend correlation-context generation to emit new key/value pairs and tags (Features, FFFeatures, MaxVariants, Failover, FMSpVer, etc.).
- Add/expand feature-flag tracing to capture seed/telemetry usage and max variant count.
- Propagate
TracingInfothrough replica client construction and update unit tests accordingly.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/http/policy/TracingInfo.java | Adds new feature flags/tags to correlation-context and new setters for load balancing/AI/failover. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/http/policy/FeatureFlagTracing.java | Tracks additional feature-flag telemetry (seed, telemetry enabled, max variants). |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/RequestTracingConstants.java | Adds new correlation-context key/tag constants. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/FeatureFlagClient.java | Parses feature-flag JSON to populate new tracing fields. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/AzureAppConfigDataLoader.java | Marks requests as failover when switching replicas. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationReplicaClientsBuilder.java | Ensures TracingInfo is shared into replica clients; marks load balancing usage. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationReplicaClient.java | Stores and exposes TracingInfo for per-client telemetry. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationConstants.java | Adds constants for AI mime profiles and feature abbreviations. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationApplicationSettingPropertySource.java | Updates tracing based on settings’ content-type. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/http/policy/TracingInfoTest.java | Adds tests for new correlation-context fields/tags. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/http/policy/FeatureFlagTracingTest.java | Adds tests for new feature-flag tracing behaviors. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationReplicaClientTest.java | Updates test construction to include TracingInfo. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationPropertySourceKeyVaultTest.java | Stubs getTracingInfo() for updated call sites. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationApplicationSettingPropertySourceTest.java | Stubs getTracingInfo() for updated call sites. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…zure-sdk-for-java into TelemetryTracingUpdate
| if (!hostType.isEmpty()) { | ||
| sb.append(",").append(RequestTracingConstants.HOST_TYPE_KEY).append("=").append(hostType); | ||
| } | ||
|
|
There was a problem hiding this comment.
Do we have dev environment tracking?
There was a problem hiding this comment.
I don't remember the reasoning, but I was told to remove it a while back. Our new providers don't have it and it was more of a guess there is no true convention like in .net.
There was a problem hiding this comment.
| /** | ||
| * Resets AI configuration tracing flags. | ||
| */ | ||
| public void resetAiConfigurationTracing() { |
There was a problem hiding this comment.
When do we reset this telemetry?
| * Sets whether telemetry is used. | ||
| * @param usesTelemetry whether telemetry is used | ||
| */ | ||
| public void setUsesTelemetry(Boolean usesTelemetry) { |
There was a problem hiding this comment.
Is all feature tracing being reset after each server call? This applies to any telemetry that is tracked on the key-value (or ff) level. App-level telemetry like "uses load balancing" or "uses key vault" doesn't change, so it doesn't need to be reset. But kv-level telemetry can change based on the value in AppConfig
There was a problem hiding this comment.
This is FeatureManagement telemetry, not store wide.
There was a problem hiding this comment.
Yes, so this needs to be reset based on what feature flags are loaded by the application.
There was a problem hiding this comment.
This is reset via resetFeatureFilterTelemetry which if you follow the code path resets every time we load/refresh. Actually now that I think about it this might actually be a bug. To de-dup everything all stores use the same FeatureFlagClient object, and they all use that one tracing. If a customer uses multiple stores we will be 1 reporting everything to the wrong store, And then reset before we can send to this store.
I'll create an issue to track this.
There was a problem hiding this comment.
Actually this might not be an issue. Here is how it works. we have a class called AzureAppConfigDataLoader this method is called once per store we are loading keys/feature flags from. One of the first things it does is reset this telemetry.
We then send the feature flag telemetry if and only if refresh is enabled. As we don't make any requests after this otherwise.
We use to load feature flags first to solve this, but that broke when we added support for Snapshots if I remember correctly as snapshots have negative priority order for feature flags.
| public void setUsesSnapshotReference(boolean usesSnapshotReference) { | ||
| this.usesSnapshotReference = usesSnapshotReference; | ||
| } |
There was a problem hiding this comment.
TLDR, I wrote the snapshot reference support, then realized none of this existed. So the answer is nowhere/in a PR I've yet to publish. I can remove it and just add it back in that PR.
Description
Updates the library with the latest tracing info for supported features. Note: as of this PR Snapshot References isn't supported.