Skip to content

Added logs for the brokerMiner tool to allow better parsing. #2482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ public AcquireTokenResult execute() throws Exception {

span.setAttribute(AttributeName.application_name.name(), getParameters().getApplicationName());
span.setAttribute(AttributeName.public_api_id.name(), getPublicApiId());

Logger.info(
TAG + methodName,
"Start" + methodName
);
try (final Scope scope = SpanExtension.makeCurrentSpan(span)) {
if (getParameters() instanceof InteractiveTokenCommandParameters) {
Logger.info(
Expand All @@ -92,7 +95,10 @@ public AcquireTokenResult execute() throws Exception {
span.setStatus(StatusCode.ERROR, "empty exception");
}
}

Logger.info(
TAG + methodName,
"End" + methodName
);
return result;
} else {
throw new IllegalArgumentException("Invalid operation parameters");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public AcquireTokenResult execute() throws Exception {
final String methodName = ":execute";

final Span span = SpanExtension.current();

Logger.info(TAG + methodName, "Start" + methodName);
span.setAttribute(AttributeName.application_name.name(), getParameters().getApplicationName());
span.setAttribute(AttributeName.public_api_id.name(), getPublicApiId());

Expand Down Expand Up @@ -139,7 +139,7 @@ public AcquireTokenResult execute() throws Exception {
span.setStatus(StatusCode.ERROR, "empty exception");
}
}

Logger.info(TAG + methodName, "End" + methodName);
return result;
} catch (final Throwable throwable) {
span.setStatus(StatusCode.ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,27 @@ public static ILocalAuthenticationResult submitDcfTokenResultSilent(@NonNull fin
public static ILocalAuthenticationResult submitAcquireTokenSilentSync(@NonNull final SilentTokenCommand command)
throws BaseException {
final CommandResult commandResult;
final String methodName = ":submitAcquireTokenSilentSync";
Logger.info(
TAG + methodName,
"Start" + methodName
);
try {
if (BuildConfig.DISABLE_ACQUIRE_TOKEN_SILENT_TIMEOUT){
commandResult = submitSilentReturningFuture(command).get();
} else {
final int silentTokenTimeOutMs = CommonFlightManager.getIntValue(CommonFlight.ACQUIRE_TOKEN_SILENT_TIMEOUT_MILLISECONDS);
commandResult = submitSilentReturningFuture(command).get(silentTokenTimeOutMs, TimeUnit.MILLISECONDS);
}

} catch (final InterruptedException | ExecutionException | TimeoutException e) {
throw ExceptionAdapter.baseExceptionFromException(e);
}

if (commandResult.getStatus() == ICommandResult.ResultStatus.COMPLETED){
return (ILocalAuthenticationResult) commandResult.getResult();
ILocalAuthenticationResult res = (ILocalAuthenticationResult) commandResult.getResult();
Logger.info(TAG + methodName, "End" + methodName);
return res;
} else if (commandResult.getStatus() == ICommandResult.ResultStatus.ERROR){
throw ExceptionAdapter.baseExceptionFromException((Throwable) commandResult.getResult());
} else if (commandResult.getStatus() == ICommandResult.ResultStatus.CANCEL){
Expand All @@ -289,7 +297,7 @@ public static FinalizableResultFuture<CommandResult> submitSilentReturningFuture
final String correlationId = initializeDiagnosticContext(commandParameters.getCorrelationId(),
commandParameters.getSdkType() == null ? SdkType.UNKNOWN.getProductName() :
commandParameters.getSdkType().getProductName(), commandParameters.getSdkVersion());

Logger.info(TAG + ":submitSilentReturningFuture", "Start:submitSilentReturningFuture");
// set correlation id on parameters as it may not already be set
commandParameters.setCorrelationId(correlationId);

Expand Down Expand Up @@ -398,6 +406,8 @@ public void run() {
codeMarkerManager.markCode(isDeviceCodeFlowRequest ? ACQUIRE_TOKEN_DCF_FUTURE_OBJECT_CREATION_END : ACQUIRE_TOKEN_SILENT_FUTURE_OBJECT_CREATION_END);
}
}));
Logger.info(TAG + ":submitSilentReturningFuture", "End:submitSilentReturningFuture");

return finalFuture;
}
}
Expand Down Expand Up @@ -536,7 +546,7 @@ private static CommandResult executeCommand(@SuppressWarnings(WarningType.rawtyp
Object result = null;
BaseException baseException = null;
CommandResult<?> commandResult = null;

Logger.info(TAG + ":executeCommand", "Start:executeCommand");
try {
//Try executing request
result = command.execute();
Expand Down Expand Up @@ -578,6 +588,8 @@ private static CommandResult executeCommand(@SuppressWarnings(WarningType.rawtyp
// set correlation id on Local Authentication Result
setCorrelationIdOnResult(commandResult, correlationId);
setTelemetryOnResultAndFlush(commandResult, correlationId);
Logger.info(TAG + ":executeCommand", "End:executeCommand");

return commandResult;
}

Expand Down Expand Up @@ -710,6 +722,10 @@ private static boolean eligibleToCache ( @NonNull final CommandResult commandRes

public static void beginInteractive (final InteractiveTokenCommand command) {
final String methodName = ":beginInteractive";
Logger.info(
TAG + methodName,
"Start" + methodName
);
synchronized (sLock) {

//Cancel interactive request if authorizationInCurrentTask() returns true OR this is a broker request.
Expand Down Expand Up @@ -789,6 +805,8 @@ public void onReceive(@NonNull PropertyBag dataBag) {
statusMsg(commandResult.getStatus().getLogStatus()));

EstsTelemetry.getInstance().flush(command, commandResult);
Logger.info(TAG + methodName,
"End" + methodName);
returnCommandResult(command, commandResult);
} finally {
DiagnosticContext.INSTANCE.clear();
Expand Down Expand Up @@ -818,7 +836,6 @@ public static String initializeDiagnosticContext (
final String correlationId = StringUtil.isNullOrEmpty(requestCorrelationId) ?
UUID.randomUUID().toString() :
requestCorrelationId;

final RequestContext rc = new RequestContext();
rc.put(DiagnosticContext.CORRELATION_ID, correlationId);
rc.put(PRODUCT, sdkType);
Expand Down
Loading