Skip to content

Comments

Setup Telemetry on Core API (only dev)#18

Merged
kingdomax merged 17 commits intomainfrom
infra/telemetry-setup
Aug 1, 2025
Merged

Setup Telemetry on Core API (only dev)#18
kingdomax merged 17 commits intomainfrom
infra/telemetry-setup

Conversation

@kingdomax
Copy link
Owner

No description provided.

@kingdomax kingdomax self-assigned this Jul 16, 2025
@github-actions
Copy link

github-actions bot commented Jul 16, 2025

PR Summary

Configured OpenTelemetry (OTel) for tracing, metrics, and logging in the Core API. Integrated OTel collector, Prometheus, Tempo, Loki, and Grafana for observability. Refactored settings using POCO pattern and configured HTTP client.

Changes

File Summary
backend/ExternalApi/GamificationApi.cs Modified GamificationApi to use named HTTP client (GamificationApi) and removed direct dependency on GamificationApiSettings.
backend/Infrastructure/Configurations/CorsConfiguration.cs Configured CORS to read allowed origins from FrontendSettings instead of hardcoding them.
backend/Infrastructure/Configurations/DependencyInjectionConfiguration.cs Configured AppDbContext to use PostgreSqlSettings for connection string. Removed direct dependency on IConfiguration.
backend/Infrastructure/Configurations/HttpClientConfiguration.cs Added HttpClientConfiguration to configure a named HTTP client (GamificationApi) with base address and authentication headers.
backend/Infrastructure/Configurations/JwtConfiguration.cs Configured JWT authentication to use JwtSettings without direct dependency on IConfiguration.
backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs Added OpenTelemetryConfiguration to configure tracing, metrics, and logging using OTLP exporter. Configured resource attributes and instrumentation for ASP.NET Core, HTTP client, runtime, process, and SQL client.
backend/Infrastructure/Configurations/SettingsConfiguration.cs Configured application settings using ConfigureAppSettings extension method.
backend/Infrastructure/Settings/FrontendSettings.cs New file. Added FrontendSettings class to represent frontend settings, including allowed URLs.
backend/Infrastructure/Settings/OtelCollectorSettings.cs New file. Added OtelCollectorSettings class to represent OpenTelemetry collector settings, including base URL.
backend/Infrastructure/Settings/PostgreSqlSettings.cs New file. Added PostgreSqlSettings class to represent PostgreSQL settings, including the default connection string.
backend/Program.cs Configured OpenTelemetry services and middleware in Program.cs. Added conditional telemetry configuration for development environment. Configured HTTP Client.
backend/Repositories/ProjectRepository.cs Added AsNoTracking() to GetByIdAsync method to improve query performance.
backend/Repositories/TaskRepository.cs Added AsNoTracking() to GetAsync method to improve query performance.
backend/Repositories/UserRepository.cs Added AsNoTracking() to GetAsync methods to improve query performance.
backend/TaskSync.csproj Added OpenTelemetry packages for tracing, metrics, logging, and instrumentation.
backend/appsettings.Development.json Updated AppInfo.AppName to Core.API and configured logging level for EF Core commands.
backend/appsettings.json Updated settings to use POCO pattern. Added Frontend, PostgreSql, and OtelCollector settings. Updated AppInfo.AppName to Core.API.
docker-compose.yml Added otel-collector, prometheus, tempo, loki, and grafana services for observability. Added profiles for app and observability.
frontend/src/sections/kanbanboard/hooks/useSignalRTaskHub.ts Fixed typo in getSeverUrl function call.
frontend/src/sections/kanbanboard/view/kanban-board-view.tsx Added a new line to improve code readability.
frontend/src/utils/env.ts Fixed typo in getSeverUrl function name.
observability/otel-collector-config.yaml New file. Added otel-collector configuration file for setting up receivers, exporters, and pipelines.
observability/prometheus.yml New file. Added prometheus configuration file for scraping metrics from otel-collector.
observability/tempo.yaml New file. Added tempo configuration file for storing and querying traces.

autogenerated by presubmit.ai

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (2)
  • 8575017: Merge branch 'main' of github.com:kingdomax/task-sync into infra/telemetry-setup
  • 2463e69: fix typo
Files Processed (2)
  • frontend/src/sections/kanbanboard/hooks/useSignalRTaskHub.ts (2 hunks)
  • frontend/src/utils/env.ts (1 hunk)
Actionable Comments (1)
  • frontend/src/sections/kanbanboard/hooks/useSignalRTaskHub.ts [6-6]

    typo: "Fix typo in function name."

Skipped Comments (2)
  • frontend/src/utils/env.ts [3-6]

    enhancement: "Use environment variables for server URL."

  • frontend/src/utils/env.ts [5-6]

    security: "Use https for production."

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • fafdbcf: add Serilog and Sink package in CoreAPI
Files Processed (1)
  • backend/TaskSync.csproj (1 hunk)
Actionable Comments (0)
Skipped Comments (0)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • ea1c9a6: add OpenTelemetry SDK to Core API
Files Processed (1)
  • backend/TaskSync.csproj (1 hunk)
Actionable Comments (0)
Skipped Comments (0)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
Files Processed (1)
  • backend/Program.cs (3 hunks)
Actionable Comments (0)
Skipped Comments (3)
  • backend/Program.cs [29-29]

    enhancement: "Add documentation for OpenTelemetry instrumentation."

  • backend/Program.cs [29-29]

    possible issue: "Check Prometheus exporter configuration."

  • backend/Program.cs [49-49]

    possible issue: "Verify Prometheus scraping endpoint configuration."

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • 902c903: make change to the packages
Files Processed (2)
  • backend/TaskSync.csproj (1 hunk)
  • frontend/src/sections/kanbanboard/view/kanban-board-view.tsx (1 hunk)
Actionable Comments (0)
Skipped Comments (0)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • 505a7c8: Merge branch 'main' into infra/telemetry-setup
Files Processed (0)
Actionable Comments (0)
Skipped Comments (0)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • f04f3fe: Configure opentelemetry SDK in Core API
Files Processed (3)
  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs (1 hunk)
  • backend/Program.cs (1 hunk)
  • backend/TaskSync.csproj (1 hunk)
Actionable Comments (0)
Skipped Comments (3)
  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs [16-16]

    maintainability: "Avoid hardcoding service name."

  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs [25-25]

    maintainability: "Avoid hardcoding the Otel Collector endpoint."

  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs [55-55]

    maintainability: "Avoid hardcoding the Otel Collector endpoint."

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • 4c53b5e: Add Otel Collector Config
Files Processed (3)
  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs (1 hunk)
  • docker-compose-partial.yml (0 hunks)
  • otel-collector-config.yaml (1 hunk)
Actionable Comments (0)
Skipped Comments (4)
  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs [17-17]

    maintainability: "Avoid hardcoding service name."

  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs [26-26]

    maintainability: "Avoid hardcoding the OpenTelemetry collector endpoint."

  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs [56-56]

    maintainability: "Avoid hardcoding the OpenTelemetry collector endpoint."

  • otel-collector-config.yaml [14-15]

    readability: "Add description for each exporter."

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • ab2abd7: scalfold telemetry modules
Files Processed (1)
  • docker-compose-partial.yml (1 hunk)
Actionable Comments (1)
  • docker-compose-partial.yml [30-30]

    security: "Security concern: Hardcoded Grafana admin password."

Skipped Comments (1)
  • docker-compose-partial.yml [4-4]

    maintainability: "Improve maintainability by using environment variables for image versions."

ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Grafana admin password is hardcoded. This is not recommended for production environments. Consider using a more secure method for setting the admin password, such as environment variables or a secrets management solution.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • 485e3a4: revert docker-compose-partial.yml
Files Processed (1)
  • docker-compose-partial.yml (0 hunks)
Actionable Comments (0)
Skipped Comments (0)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 0d72e9c: scalffold docker-compose-partial for necessary components to run on local dev
Files Processed (1)
  • docker-compose-partial.yml (1 hunk)
Actionable Comments (1)
  • docker-compose-partial.yml [3-3]

    possible bug: "Verify Postgres version for compatibility."

Skipped Comments (1)
  • docker-compose-partial.yml [44-45]

    readability: "Improve volume name for clarity."

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • 4b26cc6: move all appsettings to POCO pattern
Files Processed (12)
  • backend/ExternalApi/GamificationApi.cs (3 hunks)
  • backend/Infrastructure/Configurations/CorsConfiguration.cs (1 hunk)
  • backend/Infrastructure/Configurations/DependencyInjectionConfiguration.cs (2 hunks)
  • backend/Infrastructure/Configurations/HttpClientConfiguration.cs (1 hunk)
  • backend/Infrastructure/Configurations/JwtConfiguration.cs (1 hunk)
  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs (1 hunk)
  • backend/Infrastructure/Configurations/SettingsConfiguration.cs (1 hunk)
  • backend/Infrastructure/Settings/FrontendSettings.cs (1 hunk)
  • backend/Infrastructure/Settings/OtelCollectorSettings.cs (1 hunk)
  • backend/Infrastructure/Settings/PostgreSqlSettings.cs (1 hunk)
  • backend/Program.cs (1 hunk)
  • backend/appsettings.json (1 hunk)
Actionable Comments (0)
Skipped Comments (5)
  • backend/Infrastructure/Configurations/HttpClientConfiguration.cs [16-16]

    readability: "Add comment explaining the purpose of the 'x-gamapi-auth' header."

  • backend/Infrastructure/Configurations/OpenTelemetryConfiguration.cs [52-52]

    readability: "Add comment explaining why logging providers are cleared."

  • backend/Infrastructure/Settings/FrontendSettings.cs [5-5]

    possible issue: "Validate URLs in FrontendSettings."

  • backend/Infrastructure/Settings/OtelCollectorSettings.cs [5-5]

    possible issue: "Validate BaseUrl in OtelCollectorSettings."

  • backend/Infrastructure/Settings/PostgreSqlSettings.cs [10-10]

    possible issue: "Validate settings in PostgreSqlSettings."

Repository owner deleted a comment from github-actions bot Jul 28, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (1)
  • 241e50e: add AsNoTracking() for read-only query
Files Processed (3)
  • backend/Repositories/ProjectRepository.cs (1 hunk)
  • backend/Repositories/TaskRepository.cs (1 hunk)
  • backend/Repositories/UserRepository.cs (1 hunk)
Actionable Comments (0)
Skipped Comments (4)
  • backend/Repositories/ProjectRepository.cs [15-15]

    performance: "Consider potential side effects of using AsNoTracking()."

  • backend/Repositories/TaskRepository.cs [21-21]

    performance: "Consider potential side effects of using AsNoTracking()."

  • backend/Repositories/UserRepository.cs [16-16]

    performance: "Consider potential side effects of using AsNoTracking()."

  • backend/Repositories/UserRepository.cs [21-21]

    performance: "Consider potential side effects of using AsNoTracking()."

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Review Summary

Commits Considered (2)
  • 581713f: forgot to configure httpclient in program.cs
  • 8e3a98a: change Grafana port
Files Processed (4)
  • backend/ExternalApi/GamificationApi.cs (3 hunks)
  • backend/Program.cs (1 hunk)
  • backend/appsettings.Development.json (1 hunk)
  • docker-compose.yml (4 hunks)
Actionable Comments (0)
Skipped Comments (4)
  • backend/ExternalApi/GamificationApi.cs [36-36]

    readability: "Explain the removal of the custom header."

  • backend/Program.cs [27-28]

    best practice: "Telemetry configuration is environment-specific."

  • docker-compose.yml [19-19]

    readability: "Add description for docker-compose profiles."

  • docker-compose.yml [58-58]

    enhancement: "Pin image versions for reproducibility."

@kingdomax kingdomax changed the title Setup Telemetry on Core API Setup Telemetry on Core API (only dev) Jul 31, 2025
@kingdomax kingdomax merged commit db6b41c into main Aug 1, 2025
13 checks passed
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.

1 participant