Implements logging using OpenTelemetry as per #67#103
Implements logging using OpenTelemetry as per #67#103he1senbrg wants to merge 1 commit intoamfoss:developfrom
Conversation
|
Hefty commit, I will have to learn how all of this works myself before I review it. Will try and get it done before the weekend. |
There was a problem hiding this comment.
Pull Request Overview
This PR implements comprehensive OpenTelemetry logging and tracing as per issue #67. The changes introduce distributed tracing capabilities with proper instrumentation throughout the application.
Key changes:
- Added OpenTelemetry dependencies and configuration for tracing and metrics
- Instrumented key functions with
#[tracing::instrument]attributes - Implemented graceful shutdown with proper telemetry cleanup
- Added Debug derives to structs for better tracing support
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Added OpenTelemetry dependencies for tracing, metrics, and OTLP export |
| src/main.rs | Implemented complete OpenTelemetry setup with tracer/meter providers and graceful shutdown |
| src/routes.rs | Added tracing instrumentation to router setup function |
| src/models/*.rs | Added Debug derives to structs for better tracing support |
| src/graphql/queries/*.rs | Added tracing instrumentation and logging to GraphQL query functions |
| src/graphql/mutations/attendance_mutations.rs | Added tracing instrumentation to mutation functions |
| src/daily_task/mod.rs | Added tracing instrumentation to daily task functions |
Comments suppressed due to low confidence (1)
src/main.rs:1
- The trace sampler is set to 1.0 (100% sampling) which may generate excessive telemetry data in production. Consider making the sampling rate configurable or using a lower default value for production environments.
use async_graphql::EmptySubscription;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| #[derive(InputObject)] | ||
| #[derive(InputObject, Debug)] |
There was a problem hiding this comment.
[nitpick] The Debug derive should be placed on its own line for consistency with other derive attributes in the codebase. Consider separating it: #[derive(InputObject)] and #[derive(Debug)] on separate lines.
| #[derive(InputObject, Debug)] | |
| #[derive(InputObject)] | |
| #[derive(Debug)] |
| .with_attributes(vec![ | ||
| KeyValue::new(SERVICE_NAME, env!("CARGO_PKG_NAME")), | ||
| KeyValue::new(SERVICE_VERSION, env!("CARGO_PKG_VERSION")), | ||
| KeyValue::new(DEPLOYMENT_ENVIRONMENT_NAME, "develop"), |
There was a problem hiding this comment.
The deployment environment is hardcoded to 'develop'. This should be configurable through environment variables or the Config struct to support different deployment environments (development, staging, production).
| .unwrap(); | ||
|
|
||
| let reader = PeriodicReader::builder(exporter) | ||
| .with_interval(std::time::Duration::from_secs(30)) |
There was a problem hiding this comment.
The metrics export interval is hardcoded to 30 seconds. Consider making this configurable through environment variables or the Config struct to allow tuning for different environments.
|
Too many changes in one commit, too annoying to review. |
closes #67