-
Notifications
You must be signed in to change notification settings - Fork 306
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
Add metrics for endpointslice state #1923
Conversation
Hi @sawsa307. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @swetharepakula |
pkg/flags/flags.go
Outdated
@@ -256,7 +257,8 @@ L7 load balancing. CSV values accepted. Example: -node-port-ranges=80,8080,400-5 | |||
flag.BoolVar(&F.EnableL4ILBDualStack, "enable-l4ilb-dual-stack", false, "Enable Dual-Stack handling for L4 Internal Load Balancers") | |||
flag.BoolVar(&F.EnableMultipleIGs, "enable-multiple-igs", false, "Enable using multiple unmanaged instance groups") | |||
flag.IntVar(&F.MaxIGSize, "max-ig-size", 1000, "Max number of instances in Instance Group") | |||
flag.DurationVar(&F.MetricsExportInterval, "metrics-export-interval", 10*time.Minute, `Period for calculating and exporting metrics related to state of managed objects.`) | |||
flag.DurationVar(&F.UsageMetricsExportInterval, "usage-metrics-export-interval", 10*time.Minute, `Period for calculating and exporting metrics related to state of managed objects.`) | |||
flag.DurationVar(&F.SyncMetricsExportInterval, "sync-metrics-export-interval", 5*time.Second, `Period for calculating and exporting metrics related to state of syncer.`) |
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 curious, why so much difference, one 10 mins and the other 5 sec
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 reviewing!
The reason why we use a much smaller interval is we think 10min is too long for us to collect syncer metrics. Some errors can resolve by syncer within 10mins, and we might lose information if the export interval is too long.
In addition, we can still query and aggregate to get information for a longer period of time. It is easier to aggregate data than restore lost information.
epCountLabel = "ep_count" | ||
epsCountLabel = "eps_count" |
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.
ep is endpoint and eps endpointslice?
should not more readable to have the whole name instead ?
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. I'll update this. Thanks!
metricsInterval time.Duration | ||
} | ||
|
||
// init registers ingress usage metrics. |
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.
to register metrics you should do it only once, see example on the other file
ingress-gce/pkg/neg/metrics/metrics.go
Lines 130 to 141 in 0f312a7
var register sync.Once | |
func RegisterMetrics() { | |
register.Do(func() { | |
prometheus.MustRegister(NegOperationLatency) | |
prometheus.MustRegister(NegOperationEndpoints) | |
prometheus.MustRegister(ManagerProcessLatency) | |
prometheus.MustRegister(SyncerSyncLatency) | |
prometheus.MustRegister(LastSyncTimestamp) | |
prometheus.MustRegister(InitializationLatency) | |
}) | |
} |
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 example. Updated.
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.
Updated in #1911
/ok-to-test |
Created sync metrics collector to collect sync related metrics. Added metrics to collect the cumulative count of sync results. Added export interval flag.
Added metrics to collect the current count of syncers in each status.
Added metrics to collect the state of each endpoint.
Added metrics to collect the state of each endpointslice.
ae3557c
to
9217179
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sawsa307 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Included in #2019 |
Added metrics to collect the state of each endpointslice.
Example:
HELP neg_controller_neg_sync_endpoint_slice_state Current count of endpoint slices in each state
TYPE neg_controller_neg_sync_endpoint_slice_state gauge
neg_controller_neg_sync_endpoint_slice_state{endpoint_slice_label="endpointsliceTotal"} 3
neg_controller_neg_sync_endpoint_slice_state{endpoint_slice_label="endpointsliceWithDuplicateEP"} 0
neg_controller_neg_sync_endpoint_slice_state{endpoint_slice_label="endpointsliceWithMissingFieldEP"} 0
neg_controller_neg_sync_endpoint_slice_state{endpoint_slice_label="endpointsliceWithMissingNodeNameEP"} 0
neg_controller_neg_sync_endpoint_slice_state{endpoint_slice_label="endpointsliceWithMissingPodEP"} 0
neg_controller_neg_sync_endpoint_slice_state{endpoint_slice_label="endpointsliceWithMissingZoneEP"} 0