API Keys are managed under the Security -> API Keys section. Choose the stack, then Send Traces to view your username. Your Grafana Cloud credentials for Tempo can be found under the My Account page. This enables the OpenTelemetryProtocol (OTLP) gRPC listener. Next, create the agent-config.yaml, which is the configuration file for the Grafana Agent (which is volume mounted above). agent-config.yaml:/etc/agent-config.yaml NET project out of the /app folder and host it on the same version: "3"Ĭommand: bash -c "dotnet restore & dotnet build & dotnet run -urls working_dir: /appĬommand: "-config.file=/etc/agent-config.yaml" NET project created above.Ĭreate a docker-compose.yaml in the parent folder of /app with the following content. To keep things reliable for everyone, this walkthrough will run everything with docker-compose, including the. This is done by running the Grafana Agent locally and reconfiguring the application to send the traces to it. Printing trace data to stdout was good exercise, but now let’s upload the traces to Grafana Cloud and view them in Tempo! The instrumentation library will create a trace for each HTTP request and print it: Activity.Id: 00-024a2e1780a54e4baeae297523e1da85-4c65904b34efe14e-01 Now call the /WeatherForecast API and look for the following in the console. Adds a console exporter, which will log traces to stdout.Sets the service name to “example-app,” which is how this service will be identified in the traces.Enables tracing for basic AspNet activity, including all incoming http requests.ResourceBuilder.CreateDefault().AddService("example-app")) Public void ConfigureServices(IServiceCollection services) Next, configure OpenTelemetry in Startup.cs: using OpenTelemetry These versions are the latest at the time of this writing. Now that we have the web API, let’s start tracing HTTP requests with the OpenTelemetry nuget packages. This is the API that we will be working with. Run the application and verify that the Swagger UI is available at The template includes one API, which is GET /WeatherForecast. The code examples and libraries used here are compatible with both. If you have an existing project, that is no problem. Set up your account and follow along! Getting startedįirst let’s create a web API project using the built-in templates with the dotnet command. NET 5.0 web API, to offload traces to Tempo and logs to Loki in Grafana Cloud. Today we will look at how we can use the OpenTelemetry. OpenTelemetry is a CNCF project that standardizes observability (logs, metrics, and traces) across many languages and tools.
0 Comments
Leave a Reply. |