Skip to content

Update events guide#1987

Merged
jmacd merged 7 commits intoopen-telemetry:mainfrom
cijothomas:cijothomas/eventguide
Feb 9, 2026
Merged

Update events guide#1987
jmacd merged 7 commits intoopen-telemetry:mainfrom
cijothomas:cijothomas/eventguide

Conversation

@cijothomas
Copy link
Copy Markdown
Member

@cijothomas cijothomas commented Feb 6, 2026

Guidance updated on proper usage of Events (AKA Structured Logs with Durable Name)
Enforce at CI any direct usage of tokio/tracing or log macros.

@cijothomas cijothomas requested a review from a team as a code owner February 6, 2026 22:57
@github-actions github-actions Bot added the rust Pull requests that update Rust code label Feb 6, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.78%. Comparing base (82f7150) to head (bc53fea).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1987      +/-   ##
==========================================
- Coverage   85.78%   85.78%   -0.01%     
==========================================
  Files         513      513              
  Lines      163122   163122              
==========================================
- Hits       139941   139929      -12     
- Misses      22647    22659      +12     
  Partials      534      534              
Components Coverage Δ
otap-dataflow 87.59% <ø> (-0.02%) ⬇️
query_abstraction 80.61% <ø> (ø)
query_engine 90.23% <ø> (ø)
syslog_cef_receivers ∅ <ø> (∅)
otel-arrow-go 53.50% <ø> (ø)
quiver 92.15% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added the ci-repo Repository maintenance, build, GH workflows, repo cleanup, or other chores label Feb 6, 2026
Comment on lines +111 to +121
- `%value` -- Display formatting (`fmt::Display`)
- `?value` -- Debug formatting (`fmt::Debug`)
- `value` -- passed directly (integers, booleans, etc.)

```rust
otel_info!("node.connect",
endpoint = %addr,
config = ?node_config,
count = 42,
);
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

echo ""
echo " See docs/telemetry/events-guide.md for full details."
exit 1
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add a test that there are no space characters in the event name? (Is that a weaver thing?)
(Can it be checked in the macro?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes we need to enforce as much as possible in compile time, and then validate against published schema in CI time (via weaver).

This PR is one baby step towards that Goal.

@@ -0,0 +1,111 @@
#!/bin/bash
Copy link
Copy Markdown
Member

@albertlockett albertlockett Feb 9, 2026

Choose a reason for hiding this comment

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

Will this script catch the case where someone uses the macro in a way where, for example, the case tracing::warn! doesn't actually appear in the file? e.g.:

use tracing::warn;
// ...

warn!("...");

Would it be easier or more effective to just use the clippy rule for banned macros? We already do this for lazy_static:

disallowed-macros = [
{ path = "lazy_static::lazy_static", reason = "Please use `std::sync::LazyLock` instead." },
]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I started with clippy for this, but clippy wasn't able to distinguish "the developer wrote tracing::info!" from "the developer wrote otel_info! which expanded to tracing::info!". The script here was my cheap way to do some enforcement, while I can find better ways!

Copy link
Copy Markdown
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

I really like the update on the documentation.
I also agree with Albert, using Clippy to detect and reject tokio tracing macros might be better.

@jmacd jmacd added this pull request to the merge queue Feb 9, 2026
@jmacd
Copy link
Copy Markdown
Contributor

jmacd commented Feb 9, 2026

I suggest we merge and improve clippy settings in a future PR. Thank you @cijothomas!

Merged via the queue into open-telemetry:main with commit 4a53581 Feb 9, 2026
62 checks passed
@cijothomas cijothomas deleted the cijothomas/eventguide branch February 9, 2026 19:11
albertlockett pushed a commit that referenced this pull request Feb 10, 2026
# Change Summary
Applied suggestion from
#1987


## Are there any user-facing changes?

Yes, less expensive logs, without losing information!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-repo Repository maintenance, build, GH workflows, repo cleanup, or other chores rust Pull requests that update Rust code

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants