Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
vNext
----------

Version 22.0.3
----------
- [PATCH] Fix DualScreenActivity theme color constant (#2737)

Version 22.0.1
----------
- [PATCH] Handling https scheme for device enrollment link (#2732)
- [PATCH] Remove System Gesture Inset (#2730)

Version 22.0.0
----------
- [MINOR] Move ests telemetry behind feature flag (#2742)
- [MINOR] Update Broker ATS flow for Resource Account (#2704)
- [PATCH] Handle BadTokenException gracefully in CBA dialogs (#2731)
- [MINOR] Enable ShouldPreserveWebViewFlowOnSslError in Common (#2741)
- [MINOR] Add AAD authority validation for DUNA flow (#2740)
- [PATCH] Fix DualScreenActivity theme color constant (#2737)
- [MINOR] [SDL Assessment task] Secure webview settings (#2715)

Version 22.0.3
----------
- [PATCH] Fix DualScreenActivity theme color constant (#2737)

Version 22.0.1
----------
- [PATCH] Handling https scheme for device enrollment link (#2732)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
import com.microsoft.identity.common.java.commands.ICommandResult;
import com.microsoft.identity.common.java.exception.BaseException;
import com.microsoft.identity.common.java.exception.ServiceException;
import com.microsoft.identity.common.java.flighting.CommonFlight;
import com.microsoft.identity.common.java.flighting.CommonFlightsManager;
import com.microsoft.identity.common.java.interfaces.INameValueStorage;
import com.microsoft.identity.common.java.interfaces.IPlatformComponents;
import com.microsoft.identity.common.java.logging.DiagnosticContext;
import com.microsoft.identity.common.java.logging.Logger;
import com.microsoft.identity.common.java.opentelemetry.AttributeName;
import com.microsoft.identity.common.java.opentelemetry.SpanExtension;
import com.microsoft.identity.common.java.result.ILocalAuthenticationResult;
import com.microsoft.identity.common.java.util.StringUtil;
import com.microsoft.identity.common.java.util.ported.InMemoryStorage;
Expand Down Expand Up @@ -64,6 +68,82 @@ public class EstsTelemetry {
private final INameValueStorage<CurrentRequestTelemetry> mTelemetryMap;
private final INameValueStorage<Set<FailedRequest>> mSentFailedRequests;

/**
* A no-op implementation of EstsTelemetry that silently ignores all operations.
* Used when telemetry is disabled via feature flag.
*/
private static class NoopEstsTelemetry extends EstsTelemetry {
NoopEstsTelemetry() {
super(new InMemoryStorage<CurrentRequestTelemetry>(), new InMemoryStorage<Set<FailedRequest>>());
}

@Override
public synchronized void setUp(@NonNull LastRequestTelemetryCache lastRequestTelemetryCache) {
// No-op
}

@Override
public synchronized void setUp(@NonNull IPlatformComponents platformComponents) {
// No-op
}

@Override
public void initTelemetryForCommand(@NonNull final ICommand<?> command) {
// No-op
}

@Override
public void emit(@Nullable Map<String, String> telemetry) {
// No-op
}

@Override
public void emit(@Nullable String key, String value) {
// No-op
}

@Override
public void emit(@Nullable String key, int value) {
// No-op
}

@Override
public void emit(@Nullable String key, long value) {
// No-op
}

@Override
public void emit(@Nullable String key, boolean value) {
// No-op
}

@Override
public void emitApiId(@Nullable String apiId) {
// No-op
}

@Override
public void emitForceRefresh(boolean forceRefresh) {
// No-op
}

@Override
public synchronized void flush(@NonNull ICommand<?> command, @NonNull ICommandResult commandResult) {
// No-op
}

@NonNull
@Override
public Map<String, String> getTelemetryHeaders() {
return Collections.emptyMap();
}

@Override
public synchronized void clear() {
// No-op
}
}

/**
* A supplemental cache that can used to store telemetry that is captured outside of the
* DiagnosticContext. We have lots of code that is executed outside of a DiagnosticContext i.e.
Expand All @@ -89,12 +169,26 @@ public class EstsTelemetry {
/**
* Get an instance of {@link EstsTelemetry}. This method will return an existing
* instance of EstsTelemetry or create and return a new instance if the existing instance is null.
* If telemetry is disabled via the SKIP_ESTS_TELEMETRY feature flag, a NoopEstsTelemetry instance
* will be returned that safely ignores all telemetry operations.
*
* @return EstsTelemetry object instance
*/
public static synchronized EstsTelemetry getInstance() {
if (sEstsTelemetryInstance == null) {
sEstsTelemetryInstance = new EstsTelemetry();
// Check feature flag to decide whether to return NoopEstsTelemetry or real EstsTelemetry
final boolean shouldSkipEstsTelemetry =
CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.SKIP_ESTS_TELEMETRY);

if (shouldSkipEstsTelemetry) {
Logger.verbose(TAG, "SKIP_ESTS_TELEMETRY feature flag enabled, using NoopEstsTelemetry");
SpanExtension.current().setAttribute(AttributeName.skipped_ests_telemetry.name(), true);
sEstsTelemetryInstance = new NoopEstsTelemetry();
} else {
Logger.verbose(TAG, "SKIP_ESTS_TELEMETRY feature flag disabled, using standard EstsTelemetry");
SpanExtension.current().setAttribute(AttributeName.skipped_ests_telemetry.name(), false);
sEstsTelemetryInstance = new EstsTelemetry();
}
}

return sEstsTelemetryInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ public enum CommonFlight implements IFlightConfig {
/**
* Flight to enable WebView security settings to prevent unauthorized access.
*/
ENABLE_WEBVIEW_SECURITY_SETTINGS("EnableWebViewSecuritySettings", false);
ENABLE_WEBVIEW_SECURITY_SETTINGS("EnableWebViewSecuritySettings", false),

/**
* Flight to skip ests telemetry.
*/
SKIP_ESTS_TELEMETRY("SkipEstsTelemetry", false);

private String key;
private Object defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ package com.microsoft.identity.common.java.nativeauth.providers

import com.microsoft.identity.common.java.AuthenticationConstants
import com.microsoft.identity.common.java.eststelemetry.EstsTelemetry
import com.microsoft.identity.common.java.eststelemetry.TelemetryUtils
import com.microsoft.identity.common.java.flighting.CommonFlightsManager
import com.microsoft.identity.common.java.logging.LibraryInfoHelper
import com.microsoft.identity.common.java.nativeauth.commands.parameters.ResetPasswordStartCommandParameters
import com.microsoft.identity.common.java.nativeauth.commands.parameters.ResetPasswordSubmitCodeCommandParameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ public enum AttributeName {
/**
* Records the time (in milliseconds) spent on flight check for webcp.
*/
web_cp_flight_get_time
web_cp_flight_get_time,

/**
* Indicates if ests telemetry was skipped.
*/
skipped_ests_telemetry


}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import com.microsoft.identity.common.java.dto.IAccountRecord;
import com.microsoft.identity.common.java.eststelemetry.EstsTelemetry;
import com.microsoft.identity.common.java.exception.ClientException;
import com.microsoft.identity.common.java.flighting.CommonFlight;
import com.microsoft.identity.common.java.flighting.CommonFlightsManager;
import com.microsoft.identity.common.java.logging.DiagnosticContext;
import com.microsoft.identity.common.java.logging.Logger;
import com.microsoft.identity.common.java.logging.LibraryInfoHelper;
Expand Down
Loading