Skip to content

Can't use Otel Collector HTTPs support in Environments not exactly named Development #857

@afscrome

Description

@afscrome

Describe the bug

In some of our app hosts, we use Environment to choose what combinations of services we want to load, these environments are not called "Development"

The Otel Collector has a guard that only allows the Dev Certs to be injected if the environment is named "Development"

if (!settings.ForceNonSecureReceiver && isHttpsEnabled && builder.ExecutionContext.IsRunMode && builder.Environment.IsDevelopment())

Regression

No

Steps to reproduce

Have an app host with an environment other than `Development`

builder.AddOpenTelemetryCollector("collector")

Expected behavior

Either:

  1. Remove the environment.IsDevelopment() guard .
  2. Provide some opt in way to forceably register the dev certs, even if the environment is not named Development

Personally I'm happy with option 1 - we already have a guard for builder.ExecutionContext.IsRunMode, and run mode is really a development only thing.

Screenshots

No response

IDE and version

Other

IDE version

all

Nuget packages

CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector from main

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions