Skip to content

refactor: use plural logs to match otel - #1160

Merged
AngeloDanducci merged 6 commits into
generative-computing:mainfrom
AngeloDanducci:ad-1055
May 26, 2026
Merged

AngeloDanducci merged 6 commits into
generative-computing:mainfrom
AngeloDanducci:ad-1055

Conversation

@AngeloDanducci

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes #1055

Description

Renames instances referencing any of the MELLEA_LOG prefixed vars to MELLEA_LOGS

Testing

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

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

@AngeloDanducci
AngeloDanducci requested review from a team, jakelorocco and nrfulton as code owners May 26, 2026 16:33
@github-actions github-actions Bot added the enhancement New feature or request label May 26, 2026
Signed-off-by: AngeloDanducci <[email protected]>

@jakelorocco jakelorocco left a comment

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.

lgtm; suggested a change if you deem it necessary

Comment thread mellea/core/utils.py Outdated
Comment on lines +555 to +564
legacy_url = os.environ.get("MELLEA_LOG_WEBHOOK", "").strip()
if legacy_url:
warnings.warn(
"MELLEA_LOG_WEBHOOK is deprecated and will be removed in a future release. "
"Use MELLEA_LOGS_WEBHOOK instead.",
DeprecationWarning,
stacklevel=4,
)
return legacy_url

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.

Just to confirm, the stacklevel is set to 4 here since this is called by the configure_logging function, giving it +1 depth from the other calls?

Comment thread mellea/core/utils.py
Comment on lines +621 to +632
json_raw = os.environ.get("MELLEA_LOGS_JSON")
if json_raw is None:
legacy = os.environ.get("MELLEA_LOG_JSON", "")
if legacy:
warnings.warn(
"MELLEA_LOG_JSON is deprecated and will be removed in a future release. "
"Use MELLEA_LOGS_JSON instead.",
DeprecationWarning,
stacklevel=3,
)
json_raw = legacy
use_json = _parse_bool_env(json_raw or "", default=False)

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.

Might be worth extracting this grab new / legacy code into a helper function since there's so many call sites for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, I probably should have gone back and refactored this after repeating it for the nth time but I didn't remember there being so many.

@jakelorocco jakelorocco left a comment

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.

(meant to approve in the last review...)

Signed-off-by: AngeloDanducci <[email protected]>

@ajbozarth ajbozarth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Process question before the line-by-line: in my parallel tracing work for #444 (not yet in a PR) I decided not to do back-compat for the analogous renames. Given we're still 0.x on ~4-week releases, is the ~150 lines of deprecation infrastructure here (helper + 9 fallback sites + 9 doc rows + 8 dedicated tests) worth the carrying cost vs. a clean rename + CHANGELOG entry? Worth aligning the two efforts before this sets the pattern for future env-var renames.

Comments below assume back-compat stays. The DRY helper from the second commit is a nice cleanup; a few sites still need the same treatment.

Comment thread mellea/core/utils.py Resolved
Comment thread mellea/core/utils.py Resolved
Comment thread mellea/core/utils.py Resolved
Comment thread mellea/telemetry/logging.py Resolved
Comment thread test/telemetry/test_logging.py Resolved
Comment thread docs/docs/observability/logging.md Resolved
@AngeloDanducci

Copy link
Copy Markdown
Contributor Author

After discussion with @ajbozarth we agree to drop the deprecation handling and just let it play out in the 0.x release. Will update accordingly.

@AngeloDanducci

Copy link
Copy Markdown
Contributor Author

@ajbozarth added tests for the max bytes default - I think everything else that you raised was going to be addressed by the refactor has been removed wrt deprecation helpers if you'd like to re review.

@ajbozarth ajbozarth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cleanup looks good — code, primary test surface, and the env-var table are all in sync now. A few small leftovers below; all minor.

Comment thread docs/docs/observability/logging.md Resolved
Comment thread test/core/test_utils_logging.py Resolved
Comment thread test/telemetry/test_logging.py Resolved
Comment thread test/core/test_utils_logging.py Resolved
Comment thread mellea/core/utils.py Resolved
Comment thread mellea/core/utils.py Resolved
Comment thread mellea/telemetry/logging.py Resolved
Signed-off-by: AngeloDanducci <[email protected]>
@AngeloDanducci
AngeloDanducci added this pull request to the merge queue May 26, 2026
Merged via the queue into generative-computing:main with commit 0fda0f2 May 26, 2026
9 checks passed
@AngeloDanducci
AngeloDanducci deleted the ad-1055 branch May 26, 2026 22:26
akihikokuroda pushed a commit to akihikokuroda/mellea that referenced this pull request May 27, 2026
* use plural logs to match otel

Signed-off-by: AngeloDanducci <[email protected]>

* make legacy log var checking dry

Signed-off-by: AngeloDanducci <[email protected]>

* remove deprecation helpers

Signed-off-by: AngeloDanducci <[email protected]>

* add tests for log max bytes and defaults

Signed-off-by: AngeloDanducci <[email protected]>

* remove deprcated log vars in readme

Signed-off-by: AngeloDanducci <[email protected]>

* additional deprecation cleanup

Signed-off-by: AngeloDanducci <[email protected]>

---------

Signed-off-by: AngeloDanducci <[email protected]>
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

Development

Successfully merging this pull request may close these issues.

fix: reconcile pillar env var naming — rename MELLEA_LOG_* to MELLEA_LOGS_*

3 participants