Skip to content
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

Closed
wants to merge 13 commits into from

Conversation

sawsa307
Copy link
Contributor

@sawsa307 sawsa307 commented Jan 27, 2023

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 27, 2023
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 27, 2023
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@sawsa307
Copy link
Contributor Author

/assign @swetharepakula

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jan 27, 2023
@@ -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.`)
Copy link
Member

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

Copy link
Contributor Author

@sawsa307 sawsa307 Jan 31, 2023

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.

Comment on lines 33 to 34
epCountLabel = "ep_count"
epsCountLabel = "eps_count"
Copy link
Member

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 ?

Copy link
Contributor Author

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.
Copy link
Member

@aojea aojea Jan 28, 2023

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

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)
})
}

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in #1911

@aojea
Copy link
Member

aojea commented Jan 28, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 28, 2023
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.
@sawsa307 sawsa307 force-pushed the neg-eps-state-metric branch from ae3557c to 9217179 Compare February 2, 2023 20:00
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sawsa307
Once this PR has been reviewed and has the lgtm label, please ask for approval from swetharepakula by writing /assign @swetharepakula in a comment. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 4, 2023
@k8s-ci-robot
Copy link
Contributor

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.

@sawsa307 sawsa307 marked this pull request as draft February 4, 2023 05:50
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 4, 2023
@sawsa307
Copy link
Contributor Author

Included in #2019

@sawsa307 sawsa307 closed this Mar 22, 2023
@sawsa307 sawsa307 deleted the neg-eps-state-metric branch April 4, 2023 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants