Open DamianEdwards opened 8 months ago
The WithOtlpExporter should not be dashboard aware. Instead, we should introduce an IOtlpServerAnnotation that it can lookup and get the correct otlp server information from the resource (the first one?) that has this annotation.
The dashboard should then be made a proper app model resource that has this annotation. When the dashboard is disabled, it won’t be added to the app model and the WithOtlpExporter method won’t be able to find it and it’ll noop. It also allows other resources to be otlp servers (like an otlp collector etc).
When starting an AppHost project with the dashboard disabled, e.g. from a test using
DistributedApplicationTestBuilder.Create()
, the configuration for the dashboard's OTLP endpoint is still injected into the environment variables of resources, including projects and Node.js apps. Some resources may not handle being configured to egress OTLP to a non-existent endpoint as well as others so we should be sure not to configure resources for OTLP if we know the OTLP endpoint will not be started.