We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Elastic Cloud / APM
windows, net8
When I use Elastic.Apm in bridge mode the exceptions are recorded on Activity.RecordExceptions, I don't see them on "Errors" tab
Elastic.Apm
Activity.RecordExceptions
using System.Diagnostics; using Elastic.Apm.AspNetCore; using OpenTelemetry.Metrics; using OpenTelemetry.Trace; var builder = WebApplication.CreateBuilder(args); builder.Logging.AddOpenTelemetry(logging => { logging.IncludeFormattedMessage = true; logging.IncludeScopes = true; }); builder .Services.AddOpenTelemetry() .WithTracing(tracing => { if (builder.Environment.IsDevelopment()) { // We want to view all traces in development tracing.SetSampler(new AlwaysOnSampler()); } tracing .AddSource("Worker") .AddHttpClientInstrumentation() .AddAspNetCoreInstrumentation() .AddConsoleExporter(); }); builder.Services.AddHostedService<Worker>(); var app = builder.Build(); app.UseElasticApm(app.Configuration); app.MapGet("/", () => "Hello World!"); app.Run(); public class Worker : BackgroundService { public static readonly ActivitySource ActivitySource = new("Worker"); protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { using var activity = ActivitySource.StartActivity("Worker.ExecuteAsync"); try { throw new Exception("Something went wrong"); } catch (Exception ex) { activity?.SetStatus(Status.Error.WithDescription(ex.Message)); activity?.RecordException(ex); } await Task.Delay(TimeSpan.FromSeconds(15), stoppingToken); } } }
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <RootNamespace>elastic_apm_otel_bridnge_errors</RootNamespace> </PropertyGroup> <ItemGroup> <PackageReference Include="Elastic.Apm.AspNetCore" Version="1.30.0" /> <PackageReference Include="Elastic.Apm" Version="1.30.0" /> <PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.9.0" /> <PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" /> <PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" /> <PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" /> <PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" /> <PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" /> </ItemGroup> </Project>
Steps to reproduce the behavior:
Run the code above.
I can find errors on the "Errors" tab.
No errors are registered
The text was updated successfully, but these errors were encountered:
No branches or pull requests
APM Agent version
Elastic Cloud / APM
Environment
windows, net8
Describe the bug
When I use
Elastic.Apm
in bridge mode the exceptions are recorded onActivity.RecordExceptions
, I don't see them on "Errors" tabTo Reproduce
Steps to reproduce the behavior:
Run the code above.
Expected behavior
I can find errors on the "Errors" tab.
Actual behavior
No errors are registered
The text was updated successfully, but these errors were encountered: