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 external API calls metric #385

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

mergenci
Copy link
Member

Description of your changes

Add a metric to count the number of external API calls, so that provider users can monitor their API call rate. Doing so is essential in addressing rate limiting concerns.

I have:

  • Read and followed Upjet's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

In my provider-upjet-aws code I called, metrics.ExternalAPICalls.WithLabelValues("myService", "myOperation").Inc(). I observed the effect by visiting localhost:8080/metrics, which is the provider's Prometheus metrics endpoint.

Copy link
Collaborator

@ulucinar ulucinar left a comment

Choose a reason for hiding this comment

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

Thank you @mergenci, left some comments to discuss.

Maybe we should also warn the provider developers regarding the dangers of high cardinality, which may adversely affect the performance of the monitoring system if the provider has a very large number of observed service,operation pairs. I think such a warning would be suitable in the doc comments of the metrics.ExternalAPICalls counter.

pkg/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/metrics/metrics.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@ulucinar ulucinar left a comment

Choose a reason for hiding this comment

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

Thank you @mergenci, lgtm.

@mergenci mergenci merged commit 4c67d8e into crossplane:main Mar 28, 2024
7 checks passed
@mergenci mergenci deleted the external-api-calls-metric branch March 28, 2024 12:33
@mergenci
Copy link
Member Author

Thanks for your contributions @ulucinar 🙏

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