Skip to content

Introduce structured, span-based observability through Logger interface #3766

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wvanlint
Copy link
Contributor

@wvanlint wvanlint commented May 2, 2025

This change allows users to create hierarchical span objects through the Logger interface for specific computations, such as the handling of HTLCs. These span objects will be held in LDK across the corresponding lifetimes before being dropped, providing insight in durations and latencies.

This API is designed to be compatible with https://docs.rs/opentelemetry/latest/opentelemetry/trace/trait.Tracer.html, but can also be used more directly to derive time-based metrics or to log durations.

Hierarchical RAII spans are currently added for:

  • HTLC lifetimes, HTLC state transitions, inbound to outbound HTLC forwarding (see functional_tests.rs).
  • Ping/pong request-response pairs.

@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@wvanlint wvanlint force-pushed the trace_spans branch 2 times, most recently from d115f88 to 40a6022 Compare May 2, 2025 22:17
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 84.86395% with 89 lines in your changes missing coverage. Please review.

Project coverage is 89.37%. Comparing base (89f5217) to head (40a6022).

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 84.84% 32 Missing and 28 partials ⚠️
lightning/src/ln/channelmanager.rs 76.36% 13 Missing ⚠️
lightning/src/util/logger.rs 73.91% 6 Missing ⚠️
lightning/src/chain/channelmonitor.rs 0.00% 3 Missing ⚠️
lightning/src/ln/invoice_utils.rs 0.00% 3 Missing ⚠️
lightning-dns-resolver/src/lib.rs 0.00% 1 Missing ⚠️
lightning-net-tokio/src/lib.rs 0.00% 1 Missing ⚠️
lightning/src/ln/onion_payment.rs 83.33% 0 Missing and 1 partial ⚠️
lightning/src/util/test_utils.rs 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3766      +/-   ##
==========================================
+ Coverage   89.35%   89.37%   +0.01%     
==========================================
  Files         157      157              
  Lines      124095   124443     +348     
  Branches   124095   124443     +348     
==========================================
+ Hits       110886   111215     +329     
- Misses      10488    10510      +22     
+ Partials     2721     2718       -3     

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

This change allows users to create hierarchical span objects through the
Logger interface for specific computations, such as the handling of
HTLCs. These span objects will be held in LDK across the corresponding
lifetimes before being dropped, providing insight in durations and
latencies.
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