Skip to content

feat: integrate grafana loki#61

Merged
Dejmenek merged 5 commits into
mainfrom
59-add-support-for-grafana-loki-for-log-gathering
May 15, 2026
Merged

feat: integrate grafana loki#61
Dejmenek merged 5 commits into
mainfrom
59-add-support-for-grafana-loki-for-log-gathering

Conversation

@Dejmenek
Copy link
Copy Markdown
Owner

Summary

This PR adds Loki to the observability stack and configures the API to export logs to Loki via Serilog's OpenTelemetry sink. Documentation is updated to reflect these changes.

Changes

  • docker-compose.yml and new loki.yml: Add and configure Loki service for log aggregation.
  • Program.cs: Configure Serilog to export logs to Loki using the OTLP protocol.
  • TournamentAPI.csproj and central package files: Add Serilog OpenTelemetry sink and related dependencies.
  • README.md: Update instructions and documentation for Loki integration and Grafana data sources.

Dejmenek added 5 commits May 15, 2026 17:35
Expanded README to include Loki as part of the observability stack alongside Prometheus and Grafana. Clarified that the API exports logs to Loki via Serilog's OpenTelemetry sink. Updated Docker Compose service list and Grafana setup instructions to include Loki as a data source.
Added a complete loki.yml for deploying Loki with filesystem-based storage.
Config disables authentication, enables structured metadata, sets server to listen on port 3100, uses in-memory ring for single-instance mode, and configures TSDB schema with local directories for index and chunk storage under /tmp/loki.
Added Serilog.AspNetCore, Serilog.Extensions.Logging, and Serilog.Sinks.OpenTelemetry to project dependencies for enhanced logging and OpenTelemetry export support. Updated packages.lock.json with all required transitive dependencies. No packages were removed or downgraded.
Added a Loki service using the grafana/loki:latest image to docker-compose.yml. The service exposes port 3100, mounts configuration and data volumes, and uses a custom config file. Also introduced a named Docker volume for Loki data persistence.
Switched to .CreateBootstrapLogger() for early logging during startup.
Integrated Serilog.Sinks.OpenTelemetry to export logs to an OTLP endpoint (http://localhost:3100/otlp) using HTTP Protobuf protocol.
Set the service name to "TournamentAPI" for log resource attributes.
Added the required using statement for Serilog.Sinks.OpenTelemetry.
@Dejmenek Dejmenek linked an issue May 15, 2026 that may be closed by this pull request
@Dejmenek Dejmenek merged commit 64c92a9 into main May 15, 2026
2 checks passed
@Dejmenek Dejmenek deleted the 59-add-support-for-grafana-loki-for-log-gathering branch May 15, 2026 15:51
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

Successfully merging this pull request may close these issues.

Add support for Grafana Loki for log gathering

1 participant