Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<PackageVersion Include="Azure.Security.KeyVault.Keys" Version="4.7.0" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.24.0" />
<PackageVersion Include="Azure.Storage.Queues" Version="12.22.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="8.1.2" />
<PackageVersion Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.1.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="8.2.0" />
<PackageVersion Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.2.0" />
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.49.0" />
<PackageVersion Include="Microsoft.Azure.SignalR" Version="1.30.3" />
<PackageVersion Include="Microsoft.Azure.SignalR.Management" Version="1.30.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,12 @@ public static void AddAzureAppConfiguration(
settings.Optional);

builder.Services.AddAzureAppConfiguration(); // register IConfigurationRefresherProvider service

if (!settings.DisableTracing)
{
builder.Services.AddOpenTelemetry()
.WithTracing(traceBuilder =>
traceBuilder.AddSource(["Microsoft.Extensions.Configuration.AzureAppConfiguration"]));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ public sealed class AzureAppConfigurationSettings : IConnectionStringSettings
/// </summary>
public bool Optional { get; set; }

/// <summary>
/// Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is disabled or not.
/// </summary>
/// <value>
/// The default value is <see langword="false"/>.
/// </value>
public bool DisableTracing { get; set; }

void IConnectionStringSettings.ParseConnectionString(string? connectionString)
{
if (!string.IsNullOrEmpty(connectionString) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
"AzureAppConfiguration": {
"type": "object",
"properties": {
"DisableTracing": {
"type": "boolean",
"description": "Gets or sets a boolean value that indicates whether the OpenTelemetry tracing is disabled or not.",
"default": false
},
"Endpoint": {
"type": "string",
"format": "uri",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class ConfigurationTests
public void EndpointUriIsNullByDefault()
=> Assert.Null(new AzureAppConfigurationSettings().Endpoint);

// WIP: https://github.com/Azure/AppConfiguration-DotnetProvider/pull/645
// Tracing will be supported in the next 8.2.0 release
[Fact]
public void TracingIsEnabledByDefault()
=> Assert.False(new AzureAppConfigurationSettings().DisableTracing);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public class ConformanceTests : ConformanceTests<IConfigurationRefresherProvider
"Azure": {
"AppConfiguration": {
"Endpoint": "http://YOUR_URI",
"Optional": true
"Optional": true,
"DisableTracing": false
}
}
}
Expand Down Expand Up @@ -78,7 +79,8 @@ protected override void RegisterComponent(HostApplicationBuilder builder, Action
protected override (string json, string error)[] InvalidJsonToErrorMessage => new[]
{
("""{"Aspire": { "Microsoft": { "Extensions": { "Configuration": { "AzureAppConfiguration": { "Endpoint": "YOUR_URI"}}}}}}""", "Value does not match format \"uri\""),
("""{"Aspire": { "Microsoft": { "Extensions": { "Configuration": { "AzureAppConfiguration": { "Endpoint": "http://YOUR_URI", "Optional": "true"}}}}}}""", "Value is \"string\" but should be \"boolean\"")
("""{"Aspire": { "Microsoft": { "Extensions": { "Configuration": { "AzureAppConfiguration": { "Endpoint": "http://YOUR_URI", "Optional": "true"}}}}}}""", "Value is \"string\" but should be \"boolean\""),
("""{"Aspire": { "Microsoft": { "Extensions": { "Configuration": { "AzureAppConfiguration": { "Endpoint": "http://YOUR_URI", "DisableTracing": "true"}}}}}}""", "Value is \"string\" but should be \"boolean\""),
};

protected override void SetHealthCheck(AzureAppConfigurationSettings options, bool enabled)
Expand All @@ -89,19 +91,17 @@ protected override void SetMetrics(AzureAppConfigurationSettings options, bool e
=> throw new NotImplementedException();

protected override void SetTracing(AzureAppConfigurationSettings options, bool enabled)
// WIP: https://github.com/Azure/AppConfiguration-DotnetProvider/pull/645
// Will be supported in the next 8.2.0 release
=> throw new NotImplementedException();
=> options.DisableTracing = !enabled;

protected override void TriggerActivity(IConfigurationRefresherProvider service)
// WIP: https://github.com/Azure/AppConfiguration-DotnetProvider/pull/645
// Will be supported in the next 8.2.0 release
=> throw new NotImplementedException();
{
Thread.Sleep(1000);
service.Refreshers.First().RefreshAsync().ConfigureAwait(false).GetAwaiter().GetResult();
}

[Fact]
public void TracingEnablesTheRightActivitySource()
// WIP: Waiting for App Configuration Provider 8.2.0 release
=> RemoteExecutor.Invoke(() => /*ActivitySourceTest(key: null)*/ null).Dispose();
=> RemoteExecutor.Invoke(() => ActivitySourceTest(key: null)).Dispose();

internal sealed class EmptyTokenCredential : TokenCredential
{
Expand Down
Loading