forked from Azure/azure-sdk-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified UserAgentInterceptor and added TelemetryOptions. Modified un…
…it tests to reflect this. (Azure#345)
- Loading branch information
Showing
5 changed files
with
156 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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
49 changes: 49 additions & 0 deletions
49
sdk/core/azure-core/src/main/java/com/azure/android/core/http/options/TelemetryOptions.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.android.core.http.options; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.azure.android.core.http.ServiceClient; | ||
|
||
/** | ||
* Options for configuring telemetry sent by a {@link ServiceClient}. | ||
*/ | ||
public class TelemetryOptions { | ||
boolean telemetryDisabled; | ||
@Nullable | ||
String applicationId; | ||
|
||
/** | ||
* Creates an instance of {@link TelemetryOptions}. | ||
* | ||
* @param telemetryDisabled Whether platform information will be omitted from the user agent string sent by the | ||
* {@link ServiceClient}. | ||
* @param applicationId An optional user-specified application ID included in the user agent string sent by the | ||
* {@link ServiceClient}. | ||
*/ | ||
public TelemetryOptions(boolean telemetryDisabled, @Nullable String applicationId) { | ||
this.telemetryDisabled = telemetryDisabled; | ||
this.applicationId = applicationId; | ||
} | ||
|
||
/** | ||
* Gets a flag indicating if telemetry is disabled for calls made with the {@link ServiceClient}. | ||
* | ||
* @return {@code true} if telemetry is disabled. | ||
*/ | ||
public boolean isTelemetryDisabled() { | ||
return telemetryDisabled; | ||
} | ||
|
||
/** | ||
* Gets the application ID used in calls made by the {@link ServiceClient}. | ||
* | ||
* @return The application ID. | ||
*/ | ||
@Nullable | ||
public String getApplicationId() { | ||
return applicationId; | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.