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

Can't see the logs, traces #312

Open
felipe-lettrlabs opened this issue Feb 27, 2025 · 1 comment
Open

Can't see the logs, traces #312

felipe-lettrlabs opened this issue Feb 27, 2025 · 1 comment

Comments

@felipe-lettrlabs
Copy link

I am using Docker Compose to start the container for tests, and a .NET app to send the OpenTelemetry (OTel) data to the collector. However, when I try to see the data in Grafana, it does not appear

I got some logs in Docker

logger=authn.service t=2025-02-27T20:45:01.98711316Z level=warn msg="Failed to authenticate request" client=auth.client.session error="user token not found"

And this is my docker compose

services: grafana: container_name: grafana image: grafana/otel-lgtm:latest ports: - "3111:3000" - "4317:4317" - "4318:4318" environment: ENABLE_LOGS_ALL: "true" OTEL_METRIC_EXPORT_INTERVAL: 1000 healthcheck: test: test -e /tmp/ready interval: 5s timeout: 2s retries: 20

And my .net code

`Action configureResource = r => r.AddService(
serviceName: appBuilder.Configuration.GetValue("ServiceName", defaultValue: "otel-test")!,
serviceVersion: typeof(Program).Assembly.GetName().Version?.ToString() ?? "unknown",
serviceInstanceId: Environment.MachineName);

//var serviceName = "AppTest";
var otelUrl = "http://localhost:4317";

appBuilder.Logging.AddOpenTelemetry(options =>
{
var resourceBuilder = ResourceBuilder.CreateDefault();
configureResource(resourceBuilder);
options.SetResourceBuilder(resourceBuilder);

options
    .AddOtlpExporter(x =>
    {
        x.Endpoint = new Uri(otelUrl);
        x.Protocol = OtlpExportProtocol.Grpc;
    })
    .AddConsoleExporter();

});

appBuilder.Services.AddOpenTelemetry()
.ConfigureResource(configureResource)
.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddConsoleExporter()
.AddOtlpExporter(x =>
{
x.Endpoint = new Uri(otelUrl);
x.Protocol = OtlpExportProtocol.Grpc;
})
).WithMetrics(metrics => metrics
//.AddRuntimeInstrumentation()
.AddProcessInstrumentation()
.AddHttpClientInstrumentation()
//.AddAWSInstrumentation()
.AddMeter()
//.AddPrometheusExporter()
.AddAspNetCoreInstrumentation()
.AddConsoleExporter()
.AddOtlpExporter(x =>
{
x.Endpoint = new Uri(otelUrl);
x.Protocol = OtlpExportProtocol.Grpc;
})
);`

@zeitlinger
Copy link
Member

Are you using (or have tried using) https://github.com/grafana/docker-otel-lgtm/tree/main/examples/dotnet ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants