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

register cloud events metrics. #217

Merged
merged 2 commits into from
Nov 19, 2024
Merged

Conversation

morvencao
Copy link
Contributor

@morvencao morvencao commented Nov 18, 2024

Signed-off-by: morvencao <[email protected]>
@morvencao
Copy link
Contributor Author

/assign @clyang82

@morvencao
Copy link
Contributor Author

morvencao commented Nov 18, 2024

# curl https://localhost:8443/metrics -k -H "Authorization: Bearer $TOKEN" | grep cloudevents
# HELP cloudevents_received_total The total number of received CloudEvents.
# TYPE cloudevents_received_total counter
cloudevents_received_total{cluster="24d810e3-b42c-44c8-a1bf-cd617259358a",source="maestro",type="io.open-cluster-management.works.v1alpha1.manifestbundles"} 4
cloudevents_received_total{cluster="24d810e3-b42c-44c8-a1bf-cd617259358a",source="maestro",type="io.open-cluster-management.works.v1alpha1.manifests"} 17
# HELP cloudevents_sent_total The total number of sent CloudEvents.
# TYPE cloudevents_sent_total counter
cloudevents_sent_total{cluster="24d810e3-b42c-44c8-a1bf-cd617259358a",source="24d810e3-b42c-44c8-a1bf-cd617259358a-work-agent",type="io.open-cluster-management.works.v1alpha1.manifestbundles"} 11
cloudevents_sent_total{cluster="24d810e3-b42c-44c8-a1bf-cd617259358a",source="24d810e3-b42c-44c8-a1bf-cd617259358a-work-agent",type="io.open-cluster-management.works.v1alpha1.manifests"} 53
# curl https://localhost:8443/metrics -k -H "Authorization: Bearer $TOKEN" | grep manifestwork
# HELP manifestworks_processed_total The total number of processed manifestworks.
# TYPE manifestworks_processed_total counter
manifestworks_processed_total{action="delete",code="Success"} 1
manifestworks_processed_total{action="list",code="Success"} 1
manifestworks_processed_total{action="patch",code="Success"} 1
manifestworks_processed_total{action="watch",code="Success"} 1
# curl https://localhost:8443/metrics -k -H "Authorization: Bearer $TOKEN" | grep client_reconnected_total
# HELP cloudevents_client_reconnected_total The total number of reconnects for the CloudEvents client.
# TYPE cloudevents_client_reconnected_total counter
cloudevents_client_reconnected_total{client_id="24d810e3-b42c-44c8-a1bf-cd617259358a-work-agent"} 1

@@ -42,7 +43,7 @@ func NewSourceClient(sourceOptions *ceoptions.CloudEventsSourceOptions, resource
}

// register resource resync metrics for cloud event source client
cegeneric.RegisterResourceResyncMetrics()
cegeneric.RegisterCloudEventsMetrics(prometheus.DefaultRegisterer)
Copy link
Contributor

Choose a reason for hiding this comment

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

what is different between legacyregistry and prometheus.DefaultRegisterer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

legacyregistry is used by maestro-agent with library-go to register metrics, and prometheus.DefaultRegisterer is typically used with the Prometheus SDK to register metrics.

@clyang82
Copy link
Contributor

Do we have e2e test for metrics?

@morvencao morvencao force-pushed the br_metrics branch 2 times, most recently from cf03406 to cdef13b Compare November 19, 2024 02:44
@morvencao
Copy link
Contributor Author

@clyang82 added simple integration test as UT cover the metrics in sdk-go repo.

Copy link
Contributor

@clyang82 clyang82 left a comment

Choose a reason for hiding this comment

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

LGMT

@clyang82
Copy link
Contributor

/ok-to-test

Signed-off-by: morvencao <[email protected]>
@clyang82
Copy link
Contributor

/ok-to-test

@clyang82 clyang82 merged commit f088dc3 into openshift-online:main Nov 19, 2024
7 checks passed
@morvencao morvencao deleted the br_metrics branch November 19, 2024 07:03
machi1990 added a commit to Azure/ARO-HCP that referenced this pull request Dec 12, 2024
The following changes are included in the bump;

- ensure spec is returned in the status change event when a maestro bundle is being deleted (openshift-online/maestro#225)
- support entra auth for postgres (openshift-online/maestro#221)
- fix maestro agent resync unstable (openshift-online/maestro#220)
- register cloud events metrics(openshift-online/maestro#217)
- avoid nil point in go-sdk (openshift-online/maestro#212)
- update mqtt lib to resolve mqtt pinger problem (openshift-online/maestro#200)
- support print date in log (openshift-online/maestro#195)
- avoid race conditions on maestro-agent (openshift-online/maestro#196)
- use  orphan delete option as default option for read only update strategy (openshift-online/maestro#189)
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