forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AzureMonitorDistro] Rename public API to AddAzureMonitor (Azure#34672)
* Rename public API to AddAzureMonitor * change comment
- Loading branch information
1 parent
58a969f
commit f29b99b
Showing
8 changed files
with
80 additions
and
80 deletions.
There are no files selected for viewing
12 changes: 6 additions & 6 deletions
12
sdk/monitor/Azure.Monitor.OpenTelemetry/api/Azure.Monitor.OpenTelemetry.netstandard2.0.cs
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
51 changes: 51 additions & 0 deletions
51
sdk/monitor/Azure.Monitor.OpenTelemetry/src/AzureMonitorExtensions.cs
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,51 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Azure.Monitor.OpenTelemetry | ||
{ | ||
/// <summary> | ||
/// Extension methods for setting up Azure Monitor in an <see cref="IServiceCollection" />. | ||
/// </summary> | ||
public static class AzureMonitorExtensions | ||
{ | ||
/// <summary> | ||
/// Adds Azure Monitor into service collection. | ||
/// </summary> | ||
/// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param> | ||
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns> | ||
public static IServiceCollection AddAzureMonitor(this IServiceCollection services) | ||
{ | ||
services.TryAddSingleton<IConfigureOptions<AzureMonitorOptions>, | ||
DefaultAzureMonitorOptions>(); | ||
return services.AddAzureMonitor(o => o = new AzureMonitorOptions()); | ||
} | ||
|
||
/// <summary> | ||
/// Adds Azure Monitor into service collection. | ||
/// </summary> | ||
/// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param> | ||
/// <param name="options">The <see cref="AzureMonitorOptions" /> instance for configuration.</param> | ||
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns> | ||
public static IServiceCollection AddAzureMonitor(this IServiceCollection services, AzureMonitorOptions options) | ||
{ | ||
options ??= new AzureMonitorOptions(); | ||
return services.AddAzureMonitor(o => o.Clone(options)); | ||
} | ||
|
||
/// <summary> | ||
/// Adds Azure Monitor into service collection. | ||
/// </summary> | ||
/// <param name="services"><see cref="IServiceCollection"/>.</param> | ||
/// <param name="configureAzureMonitor">Callback action for configuring <see cref="AzureMonitorOptions"/>.</param> | ||
/// <returns><see cref="IServiceCollection"/>.</returns> | ||
public static IServiceCollection AddAzureMonitor(this IServiceCollection services, Action<AzureMonitorOptions> configureAzureMonitor) | ||
{ | ||
return AzureMonitorImplementations.AddAzureMonitorWithAction(services, configureAzureMonitor); | ||
} | ||
} | ||
} |
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
51 changes: 0 additions & 51 deletions
51
sdk/monitor/Azure.Monitor.OpenTelemetry/src/AzureMonitorOpenTelemetryExtensions.cs
This file was deleted.
Oops, something went wrong.
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
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
2 changes: 1 addition & 1 deletion
2
...nitor/Azure.Monitor.OpenTelemetry/tests/Azure.Monitor.OpenTelemetry.Demo/appsettings.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"AzureMonitorOpenTelemetry": { | ||
"AzureMonitor": { | ||
"ConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000123" | ||
} | ||
} |