Fixes AB#3584247: PBI-1 — Broker Telemetry Schema Data Model & Core Interfaces#3095
Draft
Copilot wants to merge 4 commits into
Draft
Fixes AB#3584247: PBI-1 — Broker Telemetry Schema Data Model & Core Interfaces#3095Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
|
✅ Work item link check complete. Description contains link AB#3584247 to an Azure Boards work item. |
… (PBI-1) Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-common-for-android/sessions/09541e92-6c54-4fd8-beab-81cca1bfae45 Co-authored-by: Prvnkmr337 <198076477+Prvnkmr337@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-common-for-android/sessions/09541e92-6c54-4fd8-beab-81cca1bfae45 Co-authored-by: Prvnkmr337 <198076477+Prvnkmr337@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create Broker Telemetry Schema data model and core interfaces, Fixes AB#3584247
Fixes AB#3584247: PBI-1 — Broker Telemetry Schema Data Model & Core Interfaces
Apr 22, 2026
|
❌ Invalid work item number: AB#3584247 #. Work item number must be a valid integer. Click here to learn more. |
1 similar comment
|
❌ Invalid work item number: AB#3584247 #. Work item number must be a valid integer. Click here to learn more. |
- Remove compact value property from EventTag enum (dead code, design uses human-readable names) - Apply BROKER_THREAD_ID_OFFSET (10,000) in EventCollector to avoid collision with OneAuth client-side thread IDs - Fix race condition in EventCollector.toTelemetrySchema(): snapshot events before capturing duration - Give PerformanceRecord its own CURRENT_PERF_VERSION constant (independent of TelemetrySchema version) - Add thread-safety documentation to ITelemetrySchemaProvider (set-before-share contract) - Fix TelemetrySchemaSerializationTest: assert enum name instead of removed compact value - Add duration invariant assertion to EventCollectorTest concurrency test - Fix JUnit 4 assertTrue argument order in EventCollectorTest
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.
Introduces the foundational telemetry schema data model in
common4jthat replaces the two-timestampBrokerPerformanceMetricsaggregate with a structured, per-phase event timeline for broker authentication flows.New package:
com.microsoft.identity.common.java.broker.telemetryEventTag— 24-entry enum in 6 categories (BrokerEntry,BrokerDispatch,BrokerCache,BrokerNetwork,BrokerResponse,CommonStrategy) with compact@SerializedNamevalues (e.g."bre.recv")ExecutionEvent— single timed event: tag, elapsed ms from flow start, thread ID, optional diagnostic/error codesPerformanceRecord— container for the ordered event list plus start time (ISO 8601) and total durationTelemetrySchema— top-level schema with correlation ID, auth outcome, device/power metadata, and an embeddedPerformanceRecordEventCollector— thread-safe accumulator (CopyOnWriteArrayList); timestamps events relative to construction; snapshot viatoTelemetrySchema()ITelemetrySchemaProvider—var telemetrySchema: TelemetrySchema?interface mirroringIBrokerPerformanceMetricsProviderTelemetryHelper—@JvmStatic addEventSafely(collector?, tag, …)null-safe facadeModified files
AcquireTokenResult.java/BaseException.java— implementITelemetrySchemaProvider; addmTelemetrySchemafield with getter/setter following the existingmBrokerPerformanceMetricspatternCommandParameters.java— add@Setter @EqualsAndHashCode.Exclude private transient EventCollector eventCollector(class-level@Gettercovers the getter)AuthenticationConstants.Broker— addBROKER_TELEMETRY_REQUESTandBROKER_TELEMETRY_SCHEMAIPC bundle key constantsWarning
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:
dl.google.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Xmx3072m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant(dns block)identitydivision.pkgs.visualstudio.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Xmx3072m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes AB#3584247
PBI-1: Telemetry Schema Data Model & Core Interfaces
Follow .github/copilot-instructions.md strictly.
Objective
Create the Broker Telemetry Schema data model and core interfaces in common4j. These platform-neutral (no Android dependency) classes represent structured timing data that the broker will emit during authentication flows, enabling client SDKs to surface per-request performance breakdowns.
Target Repository
Context
Today the broker emits only two aggregate timestamps (BROKER_REQUEST_RECEIVED_TIMESTAMP, BROKER_RESPONSE_GENERATION_TIMESTAMP) via BrokerPerformanceMetrics. The Telemetry Schema feature replaces this with a structured event timeline — a list of tagged timing events capturing each phase of the broker authentication flow. This PBI creates the foundational data model that all subsequent PBIs depend on.
Technical Requirements
All new files go in package com.microsoft.identity.common.java.broker.telemetry within the common4j module.
1. EventTag.kt — Enum of 24 event tags in 6 categories:
kotlin enum class EventTag(@SerializedName("v") val value: String) { // BrokerEntry (5) BrokerRequestReceived("bre.recv"), BrokerRequestDeserialized("bre.dser"), BrokerAccountLookupStart("bre.als"), BrokerAccountLookupEnd("bre.ale"), BrokerRequestValidated("bre.val"), // BrokerDispatch (3) BrokerControllerSelected("bdi.csel"), BrokerCommandQueued("bdi.cq"), BrokerCommandExecutionStart("bdi.cex"), // BrokerCache (6) BrokerCacheCheckStart("bca.cks"), BrokerCacheCheckEnd("bca.cke"), BrokerCacheHit("bca.hit"), BrokerCacheMiss("bca.miss"), BrokerCacheWriteStart("bca.wrs"), BrokerCacheWriteEnd("bca.wre"), // BrokerNetwork (5) BrokerPrtLoadStart("bne.prt"), BrokerNetworkCallStart("bne.ncs"), BrokerNetworkCallEnd("bne.nce"), BrokerTokenAcquired("bne.tok"), BrokerNetworkCallFailed("bne.nfl"), // BrokerResponse (3) BrokerResponseSerialized("brs.ser"), BrokerResponseSent("brs.snt"), BrokerRequestFailed("brs.fail"), // CommonStrategy (2) CommonHttpRequestExecute("cst.hreq"), CommonHttpResponseReceived("cst.hrsp") }2. ExecutionEvent.kt — Single timed event:
kotlin data class ExecutionEvent( @SerializedName("t") val tag: EventTag, @SerializedName("ts") val timestampMs: Long, @SerializedName("tid") val threadId: Long = Thread.currentThread().id, @SerializedName("d") val diagnosticCode: Int? = null, @SerializedName("e") val errorCode: Int? = null )3. PerformanceRecord.kt — Aggregation container:
kotlin data class PerformanceRecord( @SerializedName("version") val version: String = "1.0.0", @SerializedName("start_time") val startTime: String, // ISO 8601 UTC @SerializedName("duration") val duration: Long, // ms @SerializedName("execution_flow") val executionFlow: List<ExecutionEvent> )4. TelemetrySchema.kt — Top-level schema:
kotlin data class TelemetrySchema( @SerializedName("schema_version") val schemaVersion: String = "1.0.0", @SerializedName("correlation_id") val correlationId: String, @SerializedName("name") val name: String? = null, @SerializedName("version") val version: String? = null, @SerializedName("auth_outcome") val authOutcome: String? = null, @SerializedName("error_code") val errorCode: String? = null, @SerializedName("response_starvation_duration") val responseStarvationDuration: Int? = null, @SerializedName("power_policy") val powerPolicy: Boolean? = null, @SerializedName("device_idle") val deviceIdle: Boolean? = null, @SerializedName("perf") val performanceRecord: PerformanceRecord? = null ) { companion object { const val CURRENT_VERSION = "1.0.0" const val MIN_SUPPORTED_MAJOR = 1 } }5. EventCollector.kt — Thread-safe event accumulator:
`kotlin
class EventCollector(private val correlationId: String) {
private val events = CopyOnWriteArrayList()
private val startTimeMs: Long = System.currentTimeMillis()