Skip to content
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
3 changes: 2 additions & 1 deletion playground/CosmosEndToEnd/CosmosEndToEnd.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

var builder = DistributedApplication.CreateBuilder(args);

var cosmos = builder.AddAzureCosmosDB("cosmos").RunAsEmulator();
var cosmos = builder.AddAzureCosmosDB("cosmos")
.RunAsPreviewEmulator();

Comment on lines +8 to 10
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

The PR description notes that validating OTLP emission currently requires running the preview emulator with a specific image tag (via the configureContainer callback). This playground update switches to RunAsPreviewEmulator but doesn’t set the image tag, so it won’t exercise the intended scenario until the default tag includes the required build. Consider updating this call to pass a configureContainer callback that sets the image tag (or add a comment explaining why the playground intentionally uses the default tag).

Copilot uses AI. Check for mistakes.
var db = cosmos.AddCosmosDatabase("db");
var entries = db.AddContainer("entries", "/id", "staging-entries");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Aspire.Hosting.Azure;
/// </summary>
/// <param name="innerResource">The inner resource used to store annotations.</param>
public class AzureCosmosDBEmulatorResource(AzureCosmosDBResource innerResource)
: ContainerResource(innerResource.Name), IResource
: ContainerResource(innerResource.Name), IResource, IResourceWithEnvironment
{
internal AzureCosmosDBResource InnerResource { get; } = innerResource ?? throw new ArgumentNullException(nameof(innerResource));

Expand Down
3 changes: 3 additions & 0 deletions src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ private static IResourceBuilder<AzureCosmosDBResource> RunAsEmulator(this IResou
var emulatorSurrogate = new AzureCosmosDBEmulatorResource(builder.Resource);
var emulatorSurrogateBuilder = builder.ApplicationBuilder.CreateResourceBuilder(emulatorSurrogate);

emulatorSurrogateBuilder.WithOtlpExporter()
.WithEnvironment("ENABLE_OTLP_EXPORTER", "true");
Comment on lines +150 to +151
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

The new default OTLP configuration for the preview emulator (WithOtlpExporter + ENABLE_OTLP_EXPORTER) isn’t covered by the existing CosmosDB extension tests. Please add a test that verifies RunAsPreviewEmulator registers OTLP exporter configuration (e.g., presence of OtlpExporterAnnotation / environment callback) and that the ENABLE_OTLP_EXPORTER environment variable is set for the preview emulator container.

Copilot uses AI. Check for mistakes.

// VNext cosmosdb sets a default CERT_SECRET environment variable for the default emulator certificate and we can't
// remove it, so we need to provide "some" secret value to avoid issues with our provided certificate. This simply sets the
// dev cert used by cosmos to have a stable passphrase. Users can override by calling `WithHttpsDeveloperCertificate` again
Expand Down
Loading