Skip to content

feat: adopt structlog for structured logging - #642

Open
Sumitha007 wants to merge 4 commits into
kubeflow:mainfrom
Sumitha007:feat-structured-logging
Open

feat: adopt structlog for structured logging#642
Sumitha007 wants to merge 4 commits into
kubeflow:mainfrom
Sumitha007:feat-structured-logging

Conversation

@Sumitha007

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

This PR introduces structured logging support to the Kubeflow SDK using structlog.

Changes

  • Add a new kubeflow.common.structured_logging module.
  • Provide an opt-in configure_logging() API for configuring structured logging.
  • Add a get_logger() helper for creating structured loggers.
  • Replace logging.getLogger(__name__) with get_logger(__name__) across the SDK modules.
  • Preserve existing logging behavior until configure_logging() is explicitly called.

Which issue(s) this PR fixes

Fixes #631

Checklist

  • Docs included if any changes are user facing (not applicable)
  • Code follows the project style guidelines
  • ruff format passed
  • ruff check . passed
  • Relevant unit tests passed

@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign astefanutti for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Sridhar1030

Copy link
Copy Markdown
Member

/assign

@lntutor lntutor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

structlog is imported by the new module and by the updated SDK modules, but this PR does not change pyproject.toml or uv.lock to declare it. In a clean repository environment, uv run python -c "import structlog" currently raises ModuleNotFoundError.

That means importing an affected client after this change will fail for downstream users who install the SDK from its declared dependencies. Please add the runtime dependency to pyproject.toml, regenerate uv.lock, and add a small import/configuration test so the package dependency is covered.

@google-oss-prow

Copy link
Copy Markdown
Contributor

@lntutor: changing LGTM is restricted to collaborators

Details

In response to this:

structlog is imported by the new module and by the updated SDK modules, but this PR does not change pyproject.toml or uv.lock to declare it. In a clean repository environment, uv run python -c "import structlog" currently raises ModuleNotFoundError.

That means importing an affected client after this change will fail for downstream users who install the SDK from its declared dependencies. Please add the runtime dependency to pyproject.toml, regenerate uv.lock, and add a small import/configuration test so the package dependency is covered.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Sumitha007

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I've added the structlog dependency, updated uv.lock, and added a structured logging test. Please take another look.

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.

the file has no logging calls

@Sumitha007
Sumitha007 force-pushed the feat-structured-logging branch from e95cc0e to 1134321 Compare July 28, 2026 05:06
@Sumitha007

Copy link
Copy Markdown
Contributor Author

Thanks! I've removed the unused logger from this file.

@Sridhar1030

Copy link
Copy Markdown
Member

Thanks @Sumitha007
/lgtm
cc @andreyvelich

@google-oss-prow google-oss-prow Bot added the lgtm label Jul 28, 2026
@Sridhar1030

Copy link
Copy Markdown
Member

hey @Sumitha007 can u resolve the conflicts ?

Signed-off-by: Sumitha007 <jsumitha012@gmail.com>
Signed-off-by: Sumitha007 <jsumitha012@gmail.com>
Signed-off-by: Sumitha007 <jsumitha012@gmail.com>
Signed-off-by: Sumitha007 <jsumitha012@gmail.com>
@Sumitha007
Sumitha007 force-pushed the feat-structured-logging branch from 1134321 to c24703f Compare July 31, 2026 03:29
@google-oss-prow google-oss-prow Bot removed the lgtm label Jul 31, 2026
@google-oss-prow

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@google-oss-prow google-oss-prow Bot added size/XXL and removed size/L labels Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: adopt structlog for structured logging

3 participants