-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support sharding for probe #5735
support sharding for probe #5735
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello 👋 , sorry for taking this long to review... this one is a bit out of my comfort zone 😅
pkg/prometheus/promcfg.go
Outdated
@@ -957,6 +957,7 @@ func (cg *ConfigGenerator) generateProbeConfig( | |||
// Add configured relabelings. | |||
xc := labeler.GetRelabelingConfigs(m.TypeMeta, m.ObjectMeta, m.Spec.Targets.StaticConfig.RelabelConfigs) | |||
relabelings = append(relabelings, generateRelabelConfig(xc)...) | |||
relabelings = generateAddressShardingRelabelingRulesForProbes(relabelings, shards) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to configure sharing on every occasion? Or only when sharding is enabled in Prometheus?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For simplicity, we add the sharding relabel config in all cases (e.g. whether the number of shards is greater than 1 or not).
Can we move this line and the next one outside of the switch case since it applies to all cases (static an ingress targets)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the suggestion. this is the change e4ded8d
pkg/prometheus/promcfg.go
Outdated
@@ -909,6 +909,7 @@ func (cg *ConfigGenerator) generateProbeConfig( | |||
}, | |||
}...) | |||
} | |||
relabelings = generateAddressShardingRelabelingRulesForProbes(relabelings, shards) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep it as the last relabeling config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steven05jiang yes I think that it makes sense to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please review the change a634807. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small nit otherwise lgtm!
pkg/prometheus/promcfg.go
Outdated
|
||
if m.Spec.Targets.StaticConfig != nil || m.Spec.Targets.Ingress != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that the if statement is required
if m.Spec.Targets.StaticConfig != nil || m.Spec.Targets.Ingress != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wanted to confirm before removing it - after removing the condition, it will add relabeling configs (job name and sharding) to empty_probe
, prober_spec
, and module_config
in this test. while I'm not familiar with all use cases of probe, would it raise any compatibility issue in this case? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good remark. The operator already takes care of filtering out probes without static/ingress targets here. But even if the check doesn't work, it shouldn't be a problem to include the relabeling configs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tl;dr: my recommendation should be ok and updating the tests is fine ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. This is the update ffb2a35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job @steven05jiang and @simonpasquier!
sorry for not being very useful here 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thanks all for the review! |
Description
fix #5176.
By adding a sharding relabeling rule, prometheus operator will shard targets in the probe across the prometheus cluster.
Type of change
What type of changes does your code introduce to the Prometheus operator? Put an
x
in the box that apply.CHANGE
(fix or feature that would cause existing functionality to not work as expected)FEATURE
(non-breaking change which adds functionality)BUGFIX
(non-breaking change which fixes an issue)ENHANCEMENT
(non-breaking change which improves existing functionality)NONE
(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Changelog entry
Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.