Skip to content

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Oct 14, 2025

Changes

Introduce consistent, structured tracing across the Geneva uploader (config client, token workflows, encoding, upload pipeline) using

  • info! for lifecycle/high-level state and
  • debug! for hot-path/internal decision points, and errors which are returned.

Update the opentelemetry-exporter-geneva example too to demonstrate it:

debug-logs:

% RUST_LOG=info,geneva-uploader=debug,hyper=off,reqwest=off cargo run --example basic
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /private/tmp/opentelemetry-rust-contrib/stress/Cargo.toml
workspace: /private/tmp/opentelemetry-rust-contrib/Cargo.toml
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.71s
     Running `/private/tmp/opentelemetry-rust-contrib/target/debug/examples/basic`
WARNING: Self-signed certificates will be accepted. This should only be used in development!
2025-10-14T01:49:29.850140Z  INFO main my-system: event_id=20 user_name="user1" user_email="[email protected]" Registration successful
2025-10-14T01:49:29.850157Z  INFO main my-system: event_id=51 user_name="user2" user_email="[email protected]" Checkout successful
2025-10-14T01:49:29.850165Z  INFO main my-system: event_id=30 user_name="user3" user_email="[email protected]" User login successful
2025-10-14T01:49:29.850172Z  INFO main my-system: event_id=52 user_name="user2" user_email="[email protected]" Payment processed successfully
2025-10-14T01:49:29.850178Z ERROR main my-system: event_id=31 user_name="user4" user_email="[email protected]" Login failed - invalid credentials
2025-10-14T01:49:29.850184Z  WARN main my-system: event_id=53 user_name="user5" user_email="[email protected]" Shopping cart abandoned
2025-10-14T01:49:29.850189Z  INFO main my-system: event_id=32 user_name="user1" user_email="[email protected]" Password reset requested
2025-10-14T01:49:29.850194Z  INFO main my-system: event_id=54 user_name="user2" user_email="[email protected]" Order shipped successfully
Sleeping for 30 seconds...
2025-10-14T01:49:31.854055Z DEBUG tokio-runtime-worker geneva-uploader: Encoding and compressing 1 resource logs
2025-10-14T01:49:31.856722Z DEBUG tokio-runtime-worker geneva-uploader: Encoded log batch event_name=Log schemas=1 events=8 uncompressed_size=2928 compressed_size=1025
2025-10-14T01:49:31.856872Z DEBUG tokio-runtime-worker geneva-uploader: Uploading batch event_name=Log size=1025
2025-10-14T01:49:31.856923Z DEBUG tokio-runtime-worker geneva-uploader: Starting upload event_name=Log size=1025
2025-10-14T01:49:31.856971Z DEBUG tokio-runtime-worker geneva-uploader: Getting ingestion info (checking cache first)
2025-10-14T01:49:31.857058Z  INFO tokio-runtime-worker geneva-uploader: Fetching fresh ingestion info from Geneva Config Service
2025-10-14T01:49:31.857135Z DEBUG tokio-runtime-worker geneva-uploader: Sending config request with request_id=bec0eec8-eed1-49e6-bc17-74528111013b
2025-10-14T01:49:32.109886Z DEBUG tokio-runtime-worker geneva-uploader: Config service returned success status
2025-10-14T01:49:32.110391Z  INFO tokio-runtime-worker geneva-uploader: Successfully retrieved ingestion info moniker=pademo2diagbl
2025-10-14T01:49:32.110552Z DEBUG tokio-runtime-worker geneva-uploader: Posting to ingestion gateway event_name=Log moniker=pademo2diagbl
2025-10-14T01:49:33.649714Z DEBUG tokio-runtime-worker geneva-uploader: Upload successful event_name=Log ticket=v1|westeurope-0|0d2f8ede14644623a0b0e759d1f93ca1|0000000000000000|https://test1.diagnostics.monitoring.core.windows.net/-pademo2diagbl-GenevaCommon-RedirectionEvent031814-Ver2v0-134048801736504244-0000000000000000-eastus-Default
2025-10-14T01:49:33.649809Z DEBUG tokio-runtime-worker geneva-uploader: Successfully uploaded batch event_name=Log
2025-10-14T01:49:34.651679Z DEBUG tokio-runtime-worker geneva-uploader: Encoding and compressing 1 resource logs
2025-10-14T01:49:34.653703Z DEBUG tokio-runtime-worker geneva-uploader: Encoded log batch event_name=config_client.fetch_ingestion_info.success schemas=1 events=1 uncompressed_size=1366 compressed_size=674
2025-10-14T01:49:34.654569Z DEBUG tokio-runtime-worker geneva-uploader: Encoded log batch event_name=config_client.fetch_ingestion_info schemas=1 events=1 uncompressed_size=1271 compressed_size=636
2025-10-14T01:49:34.654638Z DEBUG tokio-runtime-worker geneva-uploader: Uploading batch event_name=config_client.fetch_ingestion_info.success size=674
2025-10-14T01:49:34.654664Z DEBUG tokio-runtime-worker geneva-uploader: Starting upload event_name=config_client.fetch_ingestion_info.success size=674
2025-10-14T01:49:34.654679Z DEBUG tokio-runtime-worker geneva-uploader: Getting ingestion info (checking cache first)
2025-10-14T01:49:34.654710Z DEBUG tokio-runtime-worker geneva-uploader: Using cached ingestion info expiry=2025-10-17 01:49:32.195044400 UTC
2025-10-14T01:49:34.654780Z DEBUG tokio-runtime-worker geneva-uploader: Posting to ingestion gateway event_name=config_client.fetch_ingestion_info.success moniker=pademo2diagbl
2025-10-14T01:49:34.655292Z DEBUG tokio-runtime-worker geneva-uploader: Uploading batch event_name=config_client.fetch_ingestion_info size=636
2025-10-14T01:49:34.655315Z DEBUG tokio-runtime-worker geneva-uploader: Starting upload event_name=config_client.fetch_ingestion_info size=636
2025-10-14T01:49:34.655325Z DEBUG tokio-runtime-worker geneva-uploader: Getting ingestion info (checking cache first)
2025-10-14T01:49:34.655341Z DEBUG tokio-runtime-worker geneva-uploader: Using cached ingestion info expiry=2025-10-17 01:49:32.195044400 UTC
2025-10-14T01:49:34.655385Z DEBUG tokio-runtime-worker geneva-uploader: Posting to ingestion gateway event_name=config_client.fetch_ingestion_info moniker=pademo2diagbl
2025-10-14T01:49:36.147432Z DEBUG tokio-runtime-worker geneva-uploader: Upload successful event_name=config_client.fetch_ingestion_info ticket=v1|southeastasia-0|8f66bace39a84e8fa1d70b696dfd5949|0000000000000000|https://test1.diagnostics.monitoring.core.windows.net/-pademo2diagbl-GenevaCommon-RedirectionEvent013391-Ver2v0-134048801757359652-0000000000000000-eastus-Default
2025-10-14T01:49:36.147516Z DEBUG tokio-runtime-worker geneva-uploader: Successfully uploaded batch event_name=config_client.fetch_ingestion_info
2025-10-14T01:49:36.148113Z DEBUG tokio-runtime-worker geneva-uploader: Upload successful event_name=config_client.fetch_ingestion_info.success ticket=v1|westeurope-0|0b52efcd46d648e6998dede00d84cebb|0000000000000000|https://test1.diagnostics.monitoring.core.windows.net/-pademo2diagbl-GenevaCommon-RedirectionEvent031986-Ver2v0-134048801759473498-0000000000000000-eastus-Default
2025-10-14T01:49:36.148164Z DEBUG tokio-runtime-worker geneva-uploader: Successfully uploaded batch event_name=config_client.fetch_ingestion_info.success
Shutting down provider

%

info-logs:

lalitb@Lalits-MacBook-Pro-2 opentelemetry-exporter-geneva % RUST_LOG=info,geneva-uploader=info,hyper=off,reqwest=off cargo run --example basic
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /private/tmp/opentelemetry-rust-contrib/stress/Cargo.toml
workspace: /private/tmp/opentelemetry-rust-contrib/Cargo.toml
   Compiling opentelemetry-exporter-geneva v0.2.0 (/private/tmp/opentelemetry-rust-contrib/opentelemetry-exporter-geneva/opentelemetry-exporter-geneva)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.19s
     Running `/private/tmp/opentelemetry-rust-contrib/target/debug/examples/basic`
WARNING: Self-signed certificates will be accepted. This should only be used in development!
2025-10-14T01:51:01.984495Z  INFO main my-system: event_id=20 user_name="user1" user_email="[email protected]" Registration successful
2025-10-14T01:51:01.984517Z  INFO main my-system: event_id=51 user_name="user2" user_email="[email protected]" Checkout successful
2025-10-14T01:51:01.984525Z  INFO main my-system: event_id=30 user_name="user3" user_email="[email protected]" User login successful
2025-10-14T01:51:01.984534Z  INFO main my-system: event_id=52 user_name="user2" user_email="[email protected]" Payment processed successfully
2025-10-14T01:51:01.984540Z ERROR main my-system: event_id=31 user_name="user4" user_email="[email protected]" Login failed - invalid credentials
2025-10-14T01:51:01.984546Z  WARN main my-system: event_id=53 user_name="user5" user_email="[email protected]" Shopping cart abandoned
2025-10-14T01:51:01.984551Z  INFO main my-system: event_id=32 user_name="user1" user_email="[email protected]" Password reset requested
2025-10-14T01:51:01.984556Z  INFO main my-system: event_id=54 user_name="user2" user_email="[email protected]" Order shipped successfully
Sleeping for 30 seconds...
2025-10-14T01:51:03.989409Z  INFO tokio-runtime-worker geneva-uploader: Fetching fresh ingestion info from Geneva Config Service
2025-10-14T01:51:04.199536Z  INFO tokio-runtime-worker geneva-uploader: Successfully retrieved ingestion info moniker=pademo2diagbl
Shutting down provider
lalitb@Lalits-MacBook-Pro-2 opentelemetry-exporter-geneva %

Please provide a brief description of the changes here.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@lalitb lalitb requested a review from a team as a code owner October 14, 2025 01:58
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 30.05780% with 121 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.3%. Comparing base (e8e5a89) to head (1156ece).

Files with missing lines Patch % Lines
...eneva/geneva-uploader/src/config_service/client.rs 29.3% 65 Missing ⚠️
...etry-exporter-geneva/geneva-uploader/src/client.rs 29.5% 31 Missing ⚠️
...eneva-uploader/src/payload_encoder/otlp_encoder.rs 36.3% 14 Missing ⚠️
.../geneva-uploader/src/ingestion_service/uploader.rs 26.6% 11 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #472     +/-   ##
=======================================
- Coverage   53.7%   53.3%   -0.4%     
=======================================
  Files         71      71             
  Lines      11262   11391    +129     
=======================================
+ Hits        6056    6080     +24     
- Misses      5206    5311    +105     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lalitb lalitb changed the title feature: Add structured internal logging for debugging for Geneva-uploader feat: Add structured internal logging for debugging for Geneva-uploader Oct 14, 2025
@lalitb lalitb requested a review from Copilot October 14, 2025 06:07
Copy link
Contributor

@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 introduces structured internal logging for debugging across the Geneva uploader components using the tracing crate. It adds info-level logs for lifecycle events (initialization, auth token acquisition) and debug-level logs for hot-path operations (encoding, compression, uploads).

  • Added comprehensive tracing throughout config client, token workflows, encoding, and upload pipeline
  • Updated the basic example with detailed documentation on how to enable geneva-uploader internal logs
  • Enhanced RUST_LOG environment variable handling in the example to merge user-specified directives with defaults

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
opentelemetry-exporter-geneva/examples/basic.rs Added documentation and improved RUST_LOG handling for geneva-uploader internal logs
geneva-uploader/src/payload_encoder/otlp_encoder.rs Added debug logging for encoding operations, compression errors, and batch statistics
geneva-uploader/src/ingestion_service/uploader.rs Added debug logging for upload lifecycle, success/failure cases, and error handling
geneva-uploader/src/config_service/client.rs Added comprehensive logging for auth workflows, cache operations, and config service interactions
geneva-uploader/src/client.rs Added info/debug logging for client initialization and batch processing operations
geneva-uploader/Cargo.toml Added tracing dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

debug!(
name: "config_client.new.certificate_read_error",
target: "geneva-uploader",
"Failed to read certificate file: {}", e
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use error = %e in the macro arguments and remove the {} placeholder from the message.

Copilot uses AI. Check for mistakes.

debug!(
name: "config_client.new.certificate_parse_error",
target: "geneva-uploader",
"Failed to parse PKCS#12 certificate: {}", e
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use error = %e in the macro arguments and remove the {} placeholder from the message.

Copilot uses AI. Check for mistakes.

debug!(
name: "config_client.new.tls_connector_error",
target: "geneva-uploader",
"Failed to build TLS connector: {}", e
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use error = %e in the macro arguments and remove the {} placeholder from the message.

Copilot uses AI. Check for mistakes.

debug!(
name: "config_client.get_workload_identity_token.create_credential_error",
target: "geneva-uploader",
"Failed to create WorkloadIdentityCredential: {}", e
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use error = %e in the macro arguments and remove the {} placeholder from the message.

Suggested change
"Failed to create WorkloadIdentityCredential: {}", e
"Failed to create WorkloadIdentityCredential",
error = %e

Copilot uses AI. Check for mistakes.

Comment on lines +477 to +478
"Workload Identity token acquisition failed. Scopes tried: {}. Last error: {}",
scope_candidates.join(", "), detail
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use structured fields like scopes = %scope_candidates.join(\", \"), error = %detail in the macro arguments.

Suggested change
"Workload Identity token acquisition failed. Scopes tried: {}. Last error: {}",
scope_candidates.join(", "), detail
scopes = %scope_candidates.join(", "),
error = %detail,
"Workload Identity token acquisition failed"

Copilot uses AI. Check for mistakes.

debug!(
name: "client.new.uploader_init",
target: "geneva-uploader",
"GenevaUploader init failed: {}", e
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use error = %e in the macro arguments and remove the {} placeholder from the message.

Suggested change
"GenevaUploader init failed: {}", e
error = %e,
"GenevaUploader init failed"

Copilot uses AI. Check for mistakes.

debug!(
name: "client.encode_and_compress_logs",
target: "geneva-uploader",
"Encoding and compressing {} resource logs", logs.len()
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use resource_logs_count = logs.len() in the macro arguments and update the message to remove the {} placeholder.

Suggested change
"Encoding and compressing {} resource logs", logs.len()
resource_logs_count = logs.len(),
"Encoding and compressing resource logs"

Copilot uses AI. Check for mistakes.

debug!(
name: "client.encode_and_compress_logs.error",
target: "geneva-uploader",
"Log compression failed: {}", e
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use error = %e in the macro arguments and remove the {} placeholder from the message.

Suggested change
"Log compression failed: {}", e
error = %e,
"Log compression failed"

Copilot uses AI. Check for mistakes.

debug!(
name: "client.encode_and_compress_spans",
target: "geneva-uploader",
"Encoding and compressing {} resource spans", spans.len()
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use resource_spans_count = spans.len() in the macro arguments and update the message to remove the {} placeholder.

Suggested change
"Encoding and compressing {} resource spans", spans.len()
resource_spans_count = spans.len(),
"Encoding and compressing resource spans"

Copilot uses AI. Check for mistakes.

debug!(
name: "client.encode_and_compress_spans.error",
target: "geneva-uploader",
"Span compression failed: {}", e
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The debug! macro should use structured logging format instead of string formatting. Use error = %e in the macro arguments and remove the {} placeholder from the message.

Suggested change
"Span compression failed: {}", e
error = %e,
"Span compression failed"

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant