[PR #1881] [MERGED] proto: clean up error logging #2674

Closed
opened 2026-03-16 11:01:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1881
Author: @hawkw
Created: 1/11/2023
Status: Merged
Merged: 1/17/2023
Merged by: @bluejekyll

Base: mainHead: eliza/log-level-audit


📝 Commits (5)

  • 578aeef proto: always log stream closed errors at DEBUG
  • 9aff5a8 proto: log DnsExchange io stream error at DEBUG
  • 142844e proto: log errors as structured tracing fields
  • d8bb323 Update crates/proto/src/xfer/dns_exchange.rs
  • edab55d Update crates/proto/src/xfer/dns_exchange.rs

📊 Changes

3 files changed (+16 additions, -13 deletions)

View changed files

📝 crates/proto/src/error.rs (+4 -0)
📝 crates/proto/src/xfer/dns_exchange.rs (+5 -2)
📝 crates/proto/src/xfer/dns_multiplexer.rs (+7 -11)

📄 Description

This branch changes some log messages in trust-dns-proto from the WARN level to the DEBUG level. In addition, while I was here, I also made a small change to improve how errors are recorded in these tracing events.

This branch consists of the following commits:

  • proto: log errors as structured tracing fields

    This commit changes trust-dns-proto to record errors dyn Error trait
    objects in structured tracing fields. This allows a tracing
    subscriber to choose to display richer representations of these errors,
    such as recording their source chains, as they are recorded as a value
    implementing the Error trait rather than an unstructured
    fmt::Debug/fmt::Display value.

  • proto: log DnsExchange io stream error at DEBUG

    Currently, this error is logged at the WARN level. However, the error
    is returned in the future's output, so user code can determine whether
    it should be logged at a higher verbosity level or hidden entirely.
    Therefore, this commit changes the error to be logged at the DEBUG
    level.

  • proto: always log stream closed errors at DEBUG

    Currently, the DnsMultiplexer will log stream closed errors at DEBUG
    if there are no active requests, or at WARN if there are active
    requests. This results in innocuous errors like a TCP stream closing
    being logged as warnings in some cases.

    Since the error is already propagated to all active requests when
    closing them, user code can determine whether this should be logged at a
    higher verbosity level or simply ignored. This commit changes the
    stream_closed_close_all function to always log at the DEBUG level.

    Fixes #1880


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1881 **Author:** [@hawkw](https://github.com/hawkw) **Created:** 1/11/2023 **Status:** ✅ Merged **Merged:** 1/17/2023 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `eliza/log-level-audit` --- ### 📝 Commits (5) - [`578aeef`](https://github.com/hickory-dns/hickory-dns/commit/578aeef794e4e3b25d3a3814a72b71c37c098fe9) proto: always log stream closed errors at `DEBUG` - [`9aff5a8`](https://github.com/hickory-dns/hickory-dns/commit/9aff5a806e9ee96a4afd3c1ed47d745fe8d0663e) proto: log DnsExchange io stream error at `DEBUG` - [`142844e`](https://github.com/hickory-dns/hickory-dns/commit/142844e16bbfca7b60205ea8c30f85725bf27ca6) proto: log errors as structured `tracing` fields - [`d8bb323`](https://github.com/hickory-dns/hickory-dns/commit/d8bb323dd3f723eaf412778696e52d2615b81a4d) Update crates/proto/src/xfer/dns_exchange.rs - [`edab55d`](https://github.com/hickory-dns/hickory-dns/commit/edab55d328669e490e3a3fa065357ea88cb25332) Update crates/proto/src/xfer/dns_exchange.rs ### 📊 Changes **3 files changed** (+16 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/proto/src/error.rs` (+4 -0) 📝 `crates/proto/src/xfer/dns_exchange.rs` (+5 -2) 📝 `crates/proto/src/xfer/dns_multiplexer.rs` (+7 -11) </details> ### 📄 Description This branch changes some log messages in `trust-dns-proto` from the `WARN` level to the `DEBUG` level. In addition, while I was here, I also made a small change to improve how errors are recorded in these `tracing` events. This branch consists of the following commits: + **proto: log errors as structured `tracing` fields** This commit changes `trust-dns-proto` to record errors `dyn Error` trait objects in structured `tracing` fields. This allows a `tracing` subscriber to choose to display richer representations of these errors, such as recording their source chains, as they are recorded as a value implementing the `Error` trait rather than an unstructured `fmt::Debug`/`fmt::Display` value. + **proto: log DnsExchange io stream error at `DEBUG`** Currently, this error is logged at the `WARN` level. However, the error is returned in the future's output, so user code can determine whether it should be logged at a higher verbosity level or hidden entirely. Therefore, this commit changes the error to be logged at the `DEBUG` level. + **proto: always log stream closed errors at `DEBUG`** Currently, the `DnsMultiplexer` will log stream closed errors at `DEBUG` if there are no active requests, or at `WARN` if there are active requests. This results in innocuous errors like a TCP stream closing being logged as warnings in some cases. Since the error is already propagated to all active requests when closing them, user code can determine whether this should be logged at a higher verbosity level or simply ignored. This commit changes the `stream_closed_close_all` function to always log at the `DEBUG` level. Fixes #1880 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:01:57 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2674
No description provided.