Skip to content

fix(license): add missing Apache 2.0 license headers to prometheus, r…#1209

Open
NETIZEN-11 wants to merge 3 commits intokrkn-chaos:mainfrom
NETIZEN-11:fix/license-headers
Open

fix(license): add missing Apache 2.0 license headers to prometheus, r…#1209
NETIZEN-11 wants to merge 3 commits intokrkn-chaos:mainfrom
NETIZEN-11:fix/license-headers

Conversation

@NETIZEN-11
Copy link
Copy Markdown
Contributor

What does this PR do?

Adds missing Apache 2.0 license headers to multiple files to ensure license compliance.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • Optimization

Description

This PR adds the standard Apache 2.0 license headers to files that were previously
missing them.

Missing license headers can cause license compliance checks to fail and may lead
to issues in open-source distribution and usage.

The update ensures that all affected files now include the required Apache 2.0
license header, maintaining consistency and compliance across the codebase.

Related Tickets & Documents

  • Related Issue #: N/A
  • Closes #: N/A

Documentation

  • Is documentation needed for this update?

Related Documentation PR (if applicable)

N/A

Checklist before requesting a review

  • Ensure the changes and proposed solution have been discussed in the relevant issue and have received acknowledgment from the community or maintainers.

  • I have performed a self-review of my code

  • If it is a core feature, I have added thorough unit tests with above 80% coverage

REQUIRED:

Description of combination of tests performed and output of run

  • Verified that all updated files now include the Apache 2.0 license header
  • Ensured no functional changes were introduced
  • Ran existing tests to confirm no regressions
python -m unittest discover -s tests -v
All tests passed successfully
No license compliance issues detected

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Add missing Apache 2.0 license headers to source and test files

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Add Apache 2.0 license headers to prometheus module files
• Add Apache 2.0 license headers to resiliency module files
• Add Apache 2.0 license headers to test files
• Ensure license compliance across codebase
Diagram
flowchart LR
  A["Source Files<br/>prometheus, resiliency"] -->|"Add License Header"| B["Compliant Files"]
  C["Test Files"] -->|"Add License Header"| B
  B -->|"Ensure"| D["License Compliance"]
Loading

Grey Divider

File Changes

1. krkn/prometheus/collector.py License compliance +16/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header with shebang
• Header includes copyright notice and license terms
• No functional code changes

krkn/prometheus/collector.py


2. krkn/resiliency/__init__.py License compliance +14/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header
• Header includes copyright notice and license terms
• Placed before module docstring

krkn/resiliency/init.py


3. krkn/resiliency/resiliency.py License compliance +16/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header with shebang
• Header includes copyright notice and license terms
• No functional code changes

krkn/resiliency/resiliency.py


View more (5)
4. krkn/resiliency/score.py License compliance +16/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header with shebang
• Header includes copyright notice and license terms
• No functional code changes

krkn/resiliency/score.py


5. tests/test_logging_and_code_quality.py License compliance +14/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header after shebang
• Header includes copyright notice and license terms
• Placed before existing module docstring

tests/test_logging_and_code_quality.py


6. tests/test_prometheus_collector.py License compliance +15/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header with shebang
• Header includes copyright notice and license terms
• Placed before existing module docstring

tests/test_prometheus_collector.py


7. tests/test_resiliency.py License compliance +15/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header with shebang
• Header includes copyright notice and license terms
• Placed before existing module docstring

tests/test_resiliency.py


8. tests/test_resiliency_score.py License compliance +15/-0

Add Apache 2.0 license header

• Add Apache 2.0 license header with shebang
• Header includes copyright notice and license terms
• Placed before existing module docstring

tests/test_resiliency_score.py


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 27, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Remediation recommended

1. Ambiguous python shebang 🐞 Bug ⛯ Reliability
Description
Several files now start with #!/usr/bin/env python, which can invoke an incompatible interpreter
when run directly (or via tooling that honors shebangs). This is risky here because at least one of
those files uses Python 3.10+ syntax (int | None), which will fail immediately under older
interpreters.
Code

krkn/resiliency/score.py[R1-2]

+#!/usr/bin/env python
+#
Evidence
krkn/resiliency/score.py now declares an ambiguous python shebang while also containing PEP604
union syntax (int | None), which requires Python 3.10+. The repo also has an established pattern
of python3 shebangs in many tests, so these new python shebangs introduce inconsistency and
increase the chance of running under the wrong interpreter.

krkn/resiliency/score.py[1-2]
krkn/resiliency/score.py[24-28]
krkn/prometheus/collector.py[1-2]
tests/test_resiliency.py[1-2]
tests/test_pod_network_chaos.py[1-2]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Multiple files added in this PR start with `#!/usr/bin/env python`. Because `python` can resolve to a different major/minor version than expected, this can break direct execution or tooling that uses shebangs—especially since at least one of these files contains Python 3.10+ syntax (e.g., `int | None`).

## Issue Context
Most tests in this repo already use `#!/usr/bin/env python3`, and CI runs on Python 3.11.

## Fix Focus Areas
- Prefer `#!/usr/bin/env python3` for executable test scripts.
- Consider removing shebangs entirely from importable library modules (e.g., `krkn/.../*.py`) unless they are intended to be executed as scripts.

### Files to update
- krkn/prometheus/collector.py[1-2]
- krkn/resiliency/resiliency.py[1-2]
- krkn/resiliency/score.py[1-2]
- tests/test_prometheus_collector.py[1-2]
- tests/test_resiliency.py[1-2]
- tests/test_resiliency_score.py[1-2]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

…esiliency and test files

Signed-off-by: Nitesh <nitesh@example.com>
@NETIZEN-11 NETIZEN-11 force-pushed the fix/license-headers branch from 271c3d7 to 1b74dbb Compare March 27, 2026 17:50
Copy link
Copy Markdown
Collaborator

@tsebastiani tsebastiani left a comment

Choose a reason for hiding this comment

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

/lgtm

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.

2 participants