Skip to content
New issue

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

Unable to use Kestrel event counters with this package #758

Closed
1 of 2 tasks
davidfowl opened this issue Nov 5, 2022 · 6 comments
Closed
1 of 2 tasks

Unable to use Kestrel event counters with this package #758

davidfowl opened this issue Nov 5, 2022 · 6 comments
Labels
bug Something isn't working comp:instrumentation.eventcounters Things related to OpenTelemetry.Instrumentation.EventCounters

Comments

@davidfowl
Copy link

davidfowl commented Nov 5, 2022

Issue with OpenTelemetry.Instrumentation.EventCounters

List of all OpenTelemetry NuGet
packages
and version that you are
using (e.g. OpenTelemetry 1.0.2):

OpenTelemetry.Extensions.Hosting 1.0.0-rc9.8
OpenTelemetry.Instrumentation.EventCounters  1.0.0-alpha.1
OpenTelemetry.Exporter.Prometheus.AspNetCore 1.4.0-beta.2

Runtime version (e.g. net462, net48, netcoreapp3.1, net6.0 etc. You can
find this information from the *.csproj file):

net60, net70

Is this a feature request or a bug?

  • Feature Request
  • Bug

What is the expected behavior?

I expected to see Kestrel's event counters on the prometheus endpoint.

What is the actual behavior?

They don't show up because of errors with the counter naming scheme. Here's the error:

Measurements from Instrument 'EventCounters.Microsoft-AspNetCore-Server-Kestrel.current-connections', Meter 'OpenTelemetry.Instrumentation.EventCounters' will be ignored. Reason: 'Instrument name is invalid.'. Suggested action: 'The name must comply with the OpenTelemetry specification'

Repro steps

<Project Sdk="Microsoft.NET.Sdk.Web">

    <PropertyGroup>
        <TargetFramework>net7.0</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9.8" />
        <PackageReference Include="OpenTelemetry.Instrumentation.EventCounters" Version="1.0.0-alpha.1" />
        <PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.4.0-beta.2" />
    </ItemGroup>
</Project>
using OpenTelemetry.Metrics;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenTelemetryMetrics(metrics =>
{
    metrics.AddPrometheusExporter();
    metrics.AddEventCountersInstrumentation(c =>
    {
        c.AddEventSources("Microsoft-AspNetCore-Server-Kestrel");
    });
});

var app = builder.Build();

app.MapGet("/", () => "Hello World!");

app.MapPrometheusScrapingEndpoint();

app.Run();

Additional Context

Add any other context about the feature request here.

@davidfowl davidfowl added the comp:instrumentation.eventcounters Things related to OpenTelemetry.Instrumentation.EventCounters label Nov 5, 2022
@Kielek Kielek added the bug Something isn't working label Nov 8, 2022
@mic-max
Copy link
Contributor

mic-max commented Nov 8, 2022

#740 should resolve this issue once merged

@mic-max
Copy link
Contributor

mic-max commented Nov 24, 2022

@utpilla #740 fixes this, you can close.

@davidfowl
Copy link
Author

Is there a new package release or release planned that would have this fix?

@Kielek
Copy link
Contributor

Kielek commented Nov 25, 2022

@davidfowl, I think all changes in this package was released together with https://www.nuget.org/packages/OpenTelemetry.Instrumentation.EventCounters/1.0.0-alpha.2

@Kielek
Copy link
Contributor

Kielek commented Nov 25, 2022

@davidfowl, if you are able to confirm that it is working correctly, please close the issue :)

@davidfowl
Copy link
Author

Confirmed it works! Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comp:instrumentation.eventcounters Things related to OpenTelemetry.Instrumentation.EventCounters
Projects
None yet
Development

No branches or pull requests

3 participants