Skip to content
Merged
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
3 changes: 1 addition & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
<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.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" />
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.11.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="8.2.0" />
<!-- Azure Management SDK for .NET dependencies -->
<PackageVersion Include="Azure.Provisioning" Version="$(AzureProvisiongVersion)" />
<PackageVersion Include="Azure.Provisioning.AppConfiguration" Version="$(AzureProvisiongVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
<AspireProjectOrPackageReference Include="Aspire.StackExchange.Redis" />
<AspireProjectOrPackageReference Include="Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration" />
<ProjectReference Include="..\..\Playground.ServiceDefaults\Playground.ServiceDefaults.csproj" />

<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" />
<PackageReference Include="Microsoft.Azure.SignalR" />
</ItemGroup>

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
@@ -1,6 +1,6 @@
# Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration

Retrieves configuration settings from Azure App Configuration to use in your application. Registers Azure App Configuration service as a configuration source. Enables corresponding logging.
Retrieves configuration settings from Azure App Configuration to use in your application. Registers Azure App Configuration service as a configuration source. Enables corresponding logging and telemetry.

## Getting started

Expand Down
4 changes: 2 additions & 2 deletions src/Components/Aspire_Components_Progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ These integrations should follow the [.NET Aspire Integration Requirements](#net
| Microsoft.Data.SqlClient | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ |
| Microsoft.EntityFramework.Cosmos | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
| Microsoft.EntityFrameworkCore.SqlServer | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
| Microsoft.Extensions.Configuration.AzureAppConfiguration | ✅ | ✅ | ✅ | ✅ | ✅ | | ❌ | |
| Microsoft.Extensions.Configuration.AzureAppConfiguration | ✅ | ✅ | ✅ | ✅ | ✅ | | ❌ | |
| MongoDB.Driver | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
| Azure.AI.Inference | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
| Azure.AI.Inference | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
| Azure.AI.OpenAI | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
| Azure.Data.Tables | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
| Azure.Messaging.EventHubs | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | |
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,18 @@ 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();
{
// wait for 1 seconds to ensure the refresh interval is exceeded
Task.Delay(1000).ConfigureAwait(false).GetAwaiter().GetResult();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to do this? Is there a way to "force" the refresh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to have a "force" refresh api. But for some reason, we removed it. In our own testsuite, we also used "waiting for some time" way to test refresh. example

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