Skip to content

Otel #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Otel #3

wants to merge 15 commits into from

Conversation

iPeluwa
Copy link
Contributor

@iPeluwa iPeluwa commented Apr 9, 2025

PR Summary

This PR wires up OpenTelemetry tracing and metrics across the entire service.

image

telemetry.rs

  • Import TracerProvider trait
    Ensures SdkTracerProvider::tracer(...) compiles correctly.
  • Build a single Resource
    Includes your service name and project key.
  • Configure OTLP gRPC exporter
    • Traces: batch exporter
    • Metrics: periodic reader (every 60 seconds)
  • Install combined tracing-subscriber
    Routes all tracing spans into OTLP.

database.rs

Adds #[tracing::instrument] spans to all public methods, capturing key parameters:

  • new
  • new_for_test
  • create_session_context
  • setup_session_context
  • register_pg_settings_table
  • register_set_config_udf
  • start_pgwire_server
  • resolve_table
  • insert_records_batch
  • insert_records
  • register_project

Each span records important fields (e.g., project_id, batch sizes, port, etc.) without changing existing logic.

Closes #

How to test

Checklist

  • [ x ] Make sure you have described your changes and added all relevant screenshots or data.
  • [ x ] Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests).
  • [ x ] Make sure to add/update documentation regarding your changes (or request one from the team).
  • [ x ] You are NOT deprecating/removing a feature.

iPeluwa added 13 commits April 10, 2025 00:33
- Introduced centralized error handling with `TimeFusionError` enum in new `error.rs` module
- Updated `main.rs` and `database.rs` to use custom `Result` type for consistent error propagation
- Added `flush_pending_writes` to `Database` for ensuring data consistency during shutdown
- Improved graceful shutdown in `main.rs` with database write monitoring and proper channel handling
- Removed unused `AppInfo` struct and `shutdown_tx` from `AppState` to eliminate dead code warnings
- Fixed move errors and unused variable warnings related to `shutdown_tx` and `shutdown_rx`
- Updated `lib.rs` to export `error` module
…ype safety

- Replaced anyhow::Result with custom TimeFusionError in columns()
- Improved schema validation with runtime checks instead of asserts
- Updated imports to include error module and removed unused serde_json::json
…n Config

- Updated Config to use String instead of Option<String> for aws_access_key_id and aws_secret_access_key
- Modified Config::from_env() to fail if AWS credentials are missing
- Updated Database::new() to pass required credentials to register_project()
- Simplified Database::new_for_test() to use required config credentials
- Updated insert_records_batch to deserialize RecordBatches into OtelLogsAndSpans
- Added validation for each record using OtelLogsAndSpans::validate()
- Ensured write operation only proceeds if all records are valid
- Included serde_arrow::SchemaLike for deserialization support
@iPeluwa iPeluwa requested a review from tonyalaribe April 11, 2025 16:39
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