How to get at WebApplicationBuilder from the ServiceDefaults project #2185
Replies: 1 comment
-
I suspect what I was initially trying to do doesn't make sense. I noticed in the aspire-starter template has a public static WebApplication MapDefaultEndpoints(this WebApplication app)
{
// Uncomment the following line to enable the Prometheus endpoint (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
// app.MapPrometheusScrapingEndpoint();
// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks("/health");
// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks("/alive", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});
return app;
} Following that pattern then, I added an AddSentry method to Extensions.cs that extends on |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm creating a sample that shows how to send Aspire telemetry data to Sentry... Sentry has an OpenTelemetry integration so getting something basic up and running was fairly straight forward (commit a37ccb). I can run the AppHost and see traces and metrics flowing through to my Sentry project.
However currently it's suboptimal. You can initialize sentry using
SentrySdk.Init
as I've done in that commit however for ASP.NET Core applications it should really be done using an extension method that Sentry provides onIWebApplicationBuilder
. TheIWebApplicationBuilder
extension method configures some startup filters, middleware and various other things that don't get initialized viaSentrySdk.Init
... and also allows you to configure various ASP.NET Core specific options for Sentry.Question
Is it possible/advisable, in the ServiceDefaults project, to create configuration that is project type specific? So, for example, I want to initilaize Sentry via one mechanism if the project is an ASP.NET Core project and via another if it's a BackgroundService or a Console app or something.
Beta Was this translation helpful? Give feedback.
All reactions