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

APIkeys: Add metrics for apikey endpoints #66732

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

eleijonmarck
Copy link
Contributor

What is this feature?

added metrics:

grafana_api_api_keys_create_total 3
grafana_api_api_keys_delete_total 1
grafana_api_api_keys_get_total 7

Why do we need this feature?
This is needed for monitoring of the use of API keys for users as part of the deprecation strategy

OG issue: #53567

@eleijonmarck eleijonmarck added this to the 9.5.x milestone Apr 18, 2023
@eleijonmarck eleijonmarck added backport v9.4.x Mark PR for automatic backport to v9.4.x and removed area/backend labels Apr 18, 2023
@grafanabot
Copy link
Contributor

Hello @eleijonmarck!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If the pull request modifies CI behaviour, please add the type/ci label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

@eleijonmarck eleijonmarck added the product-approved Pull requests that are approved by product/managers and are allowed to be backported label Apr 18, 2023
@eleijonmarck eleijonmarck added backport v9.1.x Bot will automatically open backport PR backport v9.2.x Mark PR for automatic backport to v9.2.x backport v9.3.x labels Apr 18, 2023
@eleijonmarck eleijonmarck marked this pull request as ready for review April 18, 2023 09:38
@eleijonmarck eleijonmarck requested a review from a team as a code owner April 18, 2023 09:38
@eleijonmarck eleijonmarck requested review from zserge, mildwonkey, suntala, Jguer and vtorosyan and removed request for a team April 18, 2023 09:38
@eleijonmarck eleijonmarck removed backport v9.1.x Bot will automatically open backport PR backport v9.2.x Mark PR for automatic backport to v9.2.x backport v9.3.x product-approved Pull requests that are approved by product/managers and are allowed to be backported labels Apr 18, 2023
@danielkenlee
Copy link
Contributor

Hi @eleijonmarck - backporting to 9.4 should help us gather much needed metrics to help guide the deprecation of API keys. Approved from Product.

@eleijonmarck eleijonmarck added the product-approved Pull requests that are approved by product/managers and are allowed to be backported label Apr 18, 2023
@Jguer Jguer added the backport v9.5.x Bot will automatically open backport PR label Apr 18, 2023
@Jguer
Copy link
Contributor

Jguer commented Apr 18, 2023

Since we want these stats now and we're backporting I understand placing them in pkg/infra/metrics/metrics.go. In the future they should be declared by the appropriate service.

Hopefully these counters can be removed soon

@eleijonmarck eleijonmarck modified the milestones: 9.5.x, 10.0.x Apr 18, 2023
@eleijonmarck eleijonmarck merged commit c505d26 into main Apr 18, 2023
38 checks passed
@eleijonmarck eleijonmarck deleted the eleijonmarck/apikeys/metrics branch April 18, 2023 10:12
@grafanabot
Copy link
Contributor

The backport to v9.4.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-66732-to-v9.4.x origin/v9.4.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x c505d26430e85baa20429675c8958d42ea67adf4
# Push it to GitHub
git push --set-upstream origin backport-66732-to-v9.4.x
git switch main
# Remove the local backport branch
git branch -D backport-66732-to-v9.4.x

Then, create a pull request where the base branch is v9.4.x and the compare/head branch is backport-66732-to-v9.4.x.

@grafanabot grafanabot added the backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. label Apr 18, 2023
@grafanabot
Copy link
Contributor

The backport to v9.5.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-66732-to-v9.5.x origin/v9.5.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x c505d26430e85baa20429675c8958d42ea67adf4
# Push it to GitHub
git push --set-upstream origin backport-66732-to-v9.5.x
git switch main
# Remove the local backport branch
git branch -D backport-66732-to-v9.5.x

Then, create a pull request where the base branch is v9.5.x and the compare/head branch is backport-66732-to-v9.5.x.

@eleijonmarck
Copy link
Contributor Author

this change should be reverted as we already have these metrics in place for grafana instances of OSS

eleijonmarck added a commit that referenced this pull request Apr 18, 2023
eleijonmarck added a commit that referenced this pull request Apr 18, 2023
@zerok zerok modified the milestones: 10.0.x, 10.0.0 May 3, 2023
@zerok zerok modified the milestones: 10.0.0, 10.0.0-preview May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/backend backport v9.4.x Mark PR for automatic backport to v9.4.x backport v9.5.x Bot will automatically open backport PR backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. product-approved Pull requests that are approved by product/managers and are allowed to be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants