Skip to content

Conversation

@Paramadon
Copy link
Contributor

Issue #, if available:
The operator needs a dependency upgrade for prometheus for compliance reason.

Description of changes:

Updates base image and dependencies to latest versions. Major version bumps include prometheus-operator (v0.70.0 → v0.87.0), prometheus (v0.48.1 → v0.308.0), and otel collector featuregate (v0.77.0 → v1.45.0).

Adapts code to breaking API changes:

  • GenerateServerConfiguration() now requires a Prometheus CRD object
  • Logging migrated from go-kit/log to log/slog
  • assets.Store renamed to assets.StoreBuilder
  • Featuregate flag registration API updated

No functional changes.

TLSCertFilePath: "/path/to/cert.pem",
TLSKeyFilePath: "/path/to/key.pem",
},
PromConfig: &promconfig.Config{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prometheus library v0.308.0 populates additional default fields internally. Switched from exact struct comparison to field-by-field assertion to avoid test brittleness across library versions. Config loading behavior unchanged.

"github.com/aws/amazon-cloudwatch-agent-operator/cmd/amazon-cloudwatch-agent-target-allocator/target"
)

func init() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prometheus v0.308.0 changed default metric name validation. This aligns test validation scheme with prometheus-operator's config generation to prevent assertion mismatches.

return nil, pmRetrieveErr
}

// Collect all namespaces from service monitors and pod monitors
Copy link
Contributor Author

Choose a reason for hiding this comment

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

prometheus-operator v0.87.0 changed GenerateServerConfiguration() to require a Prometheus CRD object. This constructs one dynamically using namespaces from discovered monitors. Functionally equivalent to the previous parameter-based approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

I might want to make sure this is covered too

@Paramadon Paramadon marked this pull request as ready for review December 8, 2025 15:56
newLabels := make([]labels.Label, len(lbls))
index := 0
// helper function converts from model.LabelSet to labels.Labels.
func convertLabelToPromLabelSet(lbls model.LabelSet) labels.Labels {
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to make sure the changes made here are covered with unit tests

@musa-asad
Copy link
Contributor

If @okankoAMZ signs off on the two above changes I pointed out (since he wrote this portion), it's fine by me

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