← Back to Pull requests

feat: json logging format #3137

Open
unknown opened this pull request with 274 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 02, 2026 21:31 UTC
Author

<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide/pull-requests.md#the-pull-request-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. If you want faster PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/pull-requests.md#write-release-notes-if-needed
4. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

<!-- markdownlint-disable-next-line MD041 -->
What this PR does / why we need it:

Adds a --logging-format flag (text default, json) so log aggregators can parse kube-state-metrics output as structured JSON. Uses component-base's JSON logger, same flag name as kubelet/kube-apiserver. Existing klog flags (-v, --log_dir, ...) keep working; -v is carried over in JSON mode. Also migrates remaining klog.Warning/Infoln calls to structured InfoS.

<!-- If you are adding a new metric, provide the use case of that metric. -->

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)

Which issue(s) this PR fixes: (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged)
Fixes #1485

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

New Features
Added a --logging-format option supporting text (the default) and JSON output. Selecting a format preserves the configured verbosity.
Updates
Expanded command-line documentation to describe the logging format option.
Updated operational messages to use structured logging. Probe failures and ignored configuration-file errors are now reported at info level.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 274 lines (+205 / -69) across 3 files Reviewer: CatherineF-dev Review duration: 87300m
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 274 lines diff across 3 files
0.47
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
44%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.336
Real PR Conversation Timeline
1 comments
"Review active on #3137"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 44.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 46.5% (MEDIUM) · Higher = larger blast radius
46.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 44.7% · Lower = rushed or shallow review
44.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 25.7% · Safe to merge
25.7%