Skip to content

refactor: add otel tracing filter to logging#859

Merged
AngeloDanducci merged 4 commits into
generative-computing:mainfrom
AngeloDanducci:ad-458
Apr 17, 2026
Merged

refactor: add otel tracing filter to logging#859
AngeloDanducci merged 4 commits into
generative-computing:mainfrom
AngeloDanducci:ad-458

Conversation

@AngeloDanducci
Copy link
Copy Markdown
Contributor

@AngeloDanducci AngeloDanducci commented Apr 15, 2026

Misc PR

Will need to update after #457 is merged to use MelleaLogger

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

@AngeloDanducci AngeloDanducci requested review from a team, jakelorocco and nrfulton as code owners April 15, 2026 07:36
@github-actions github-actions Bot added the enhancement New feature or request label Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

Copy link
Copy Markdown
Contributor

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Edit: I tried letting Claude review and post this time while I was working on a different task

Review: OTel Trace Context Injection

Clean, well-motivated addition. The no-op guard when OTel isn't installed is correct, the test coverage is thorough, and the _otel_span context manager is a solid test helper. A few issues worth addressing before merging.

Bugs:

  1. Unsafe span_id access in JsonFormatter._build_log_dict — crashes if span_id is absent when trace_id is present
  2. trace_id / span_id not added to RESERVED_LOG_RECORD_ATTRS — silent overwrite risk from set_log_context

Design / Clarity:
3. Integration tests mutate the MelleaLogger singleton without resetting it first — order-dependent flakiness risk

Nits:

  • Blank line removal before # Apply include/exclude filtering is an unrelated cosmetic change
  • Docstring update on private _build_log_dict is redundant; the public format() already got the note

Comment thread mellea/core/utils.py Outdated
Comment thread test/core/test_utils_logging.py
Comment thread test/core/test_utils_logging.py
Copy link
Copy Markdown
Contributor

@jakelorocco jakelorocco left a comment

Choose a reason for hiding this comment

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

A few questions but lgtm without more changes. Thank you

Comment thread mellea/core/utils.py
Comment thread test/core/test_utils_logging.py
@AngeloDanducci AngeloDanducci added this pull request to the merge queue Apr 17, 2026
Merged via the queue into generative-computing:main with commit 6624f82 Apr 17, 2026
4 checks passed
@AngeloDanducci AngeloDanducci deleted the ad-458 branch April 17, 2026 15:32
@AngeloDanducci
Copy link
Copy Markdown
Contributor Author

AngeloDanducci commented Apr 17, 2026

@ajbozarth
Copy link
Copy Markdown
Contributor

I believe these are already addressed @ajbozarth

Yeah I deleted my comment, I didn't noticed that since the branch had been deleted already that I hadn't actually pulled latest code for Claude to look at

akihikokuroda pushed a commit to akihikokuroda/mellea that referenced this pull request May 27, 2026
* add custom logging filter using otel

* add additional logging tests

* handle edge case and testing

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

Labels

enhancement New feature or request

Projects

None yet

3 participants