Skip to content

Comments

Implement context-based logger propagation#994

Merged
aymericDD merged 15 commits intomainfrom
aymeric.daurelle/feat/logger
Oct 28, 2025
Merged

Implement context-based logger propagation#994
aymericDD merged 15 commits intomainfrom
aymeric.daurelle/feat/logger

Conversation

@aymericDD
Copy link
Contributor

@aymericDD aymericDD commented Oct 1, 2025

What does this PR do?

  • Adds new functionality
  • Alters existing functionality
  • Fixes a bug
  • Improves documentation or testing

Please briefly describe your changes as well as the motivation behind them:

  • Implements context-based logger propagation system to ensure consistent logging across all chaos controller components
  • Refactors all function signatures to remove explicit logger parameters in favor of context-based retrieval
  • Updates cloud service managers to accept context and use contextual loggers for better traceability
  • Adds comprehensive test coverage for logger context functionality and storage/retrieval scenarios
  • Standardizes observability tag formatting across all files.
  • Fix mini-kube by upgrading the k8s version.
  • Add auto reruns for e2e-test in the Circle-CI.

Code Quality Checklist

  • The documentation is up to date.
  • My code is sufficiently commented and passes continuous integration checks.
  • I have signed my commit (see Contributing Docs).

Testing

  • I leveraged continuous integration testing
    • by depending on existing unit tests or end-to-end tests.
    • by adding new unit tests or end-to-end tests.
  • I manually tested the following steps:
    • Logger context propagation works correctly across all components
    • Pod Replacement disruption validates and executes properly with different configurations
    • Existing disruption types continue to work with the new logger system
    • Cloud service IP range management functions with context-based logging
    • locally.
    • as a canary deployment to a cluster.

Linked to CHAOSPLT-1211

Refactors the logger system to propagate loggers through context across all components. Removes explicit logger parameters in favor of context-based logger retrieval. Updates all cloud service managers, disruption handlers, and test infrastructure to use the new logger context API.
@aymericDD aymericDD marked this pull request as ready for review October 1, 2025 16:54
@aymericDD aymericDD requested a review from a team as a code owner October 1, 2025 16:54
@datadog-official
Copy link

datadog-official bot commented Oct 1, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c072793 | Docs | Was this helpful? Give us feedback!

Copy link
Contributor

@clairecng clairecng left a comment

Choose a reason for hiding this comment

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

some nitpicks.

Adds TargetNameKey constant and updates all logging statements to use consistent "targetName" key instead of mixed "target"/"targetName" usage across codebase.
- Add comprehensive logging key constants for disruptions,
  pods, nodes, and chaos operations
- Implement context-based logger propagation throughout
  controllers, watchers, and services
- Move FormatTag to new o11y/tags package for better
  architectural separation of concerns
- Standardize structured logging patterns across all
  components (controllers, watchers, injectors, webhooks)
- Update metrics and event notifiers to use consistent
  tag formatting patterns
@aymericDD aymericDD requested review from clairecng and diyarab October 3, 2025 14:12
aymericDD and others added 8 commits October 14, 2025 12:21
Centralized all logging tag keys to use constants from o11y/tags/tags.go,
ensuring compliance with Datadog naming conventions (lowercase, underscores).
Replaced hardcoded strings across 64 files with typed constants for
better maintainability and consistency.

Key improvements:
- Organized tag constants by functional clusters (generic, events, timing, etc.)
- Added 80+ missing tag constants for complete coverage
- Removed duplicate constants and mock files
- Enhanced observability infrastructure with structured logging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Jira: CHAOSPLT- 1211
Implement context-based logger propagation across
all event notifiers for better observability.

Jira: CHAOSPLT-1211
Jira: CHAOSPLT- 1211
Jira: CHAOSPLT- 1211
Jira: CHAOSPLT- 1211
Jira: CHAOSPLT- 1211
Jira: CHAOSPLT- 1211
Jira: CHAOSPLT-1211
@aymericDD aymericDD mentioned this pull request Oct 28, 2025
11 tasks
Copy link
Contributor

@jedddog jedddog left a comment

Choose a reason for hiding this comment

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

I have some interest in this change for the CPUSET tests, but definitely was not confident to change the k8s version. I am glad you are! :)

@aymericDD aymericDD merged commit f60eae7 into main Oct 28, 2025
19 checks passed
@aymericDD aymericDD deleted the aymeric.daurelle/feat/logger branch October 28, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants