Skip to content

Conversation

he1senbrg
Copy link
Member

@he1senbrg he1senbrg commented May 5, 2025

closes #67

@ivinjabraham
Copy link
Member

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.

Copy link

@Copilot Copilot AI 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 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)]
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

[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.

Suggested change
#[derive(InputObject, Debug)]
#[derive(InputObject)]
#[derive(Debug)]

Copilot uses AI. Check for mistakes.

.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"),
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.

.unwrap();

let reader = PeriodicReader::builder(exporter)
.with_interval(std::time::Duration::from_secs(30))
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.

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.

2 participants