Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add label 'state' to metric 'gitea_users'#34326

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@tobiasbp
Copy link
Contributor

@tobiasbptobiasbp commentedApr 30, 2025
edited by lunny
Loading

This PR adds the labelstate to the metricgitea_users. With the change,gitea_users would be reported like this:

...# HELP gitea_users Number of Users# TYPE gitea_users gaugegitea_users{state="active"} 20gitea_users{state="inactive"} 10...

The metrics above would be from a Gitea instance with 30 user accounts. 20 of the accounts are active and 10 of the accounts are not active.

Resolve#34325

@GiteaBotGiteaBot added the lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelApr 30, 2025
@github-actionsgithub-actionsbot added the modifies/goPull requests that update Go code labelApr 30, 2025
@TheFox0x7
Copy link
Contributor

I'd personally prefer to have labelstate withactive,inactive states. It's more flexible that way in case of extension needed.

# HELP gitea_users Number of Users# TYPE gitea_users gaugegitea_users{state="active"} 20gitea_users{state="inactive"} 10

Also the metrics should probably end with_total, but I have to doublecheck this...

@tobiasbp
Copy link
ContributorAuthor

tobiasbp commentedApr 30, 2025
edited
Loading

I'd personally prefer to have labelstate withactive,inactive states. It's more flexible that way in case of extension needed.

Good suggestion. I'll change it.

@tobiasbp
Copy link
ContributorAuthor

Also the metrics should probably end with_total, but I have to doublecheck this...

I'm not sure about making that change a part of thisPR, since it would be a breaking change.

@tobiasbptobiasbp changed the titlefeat: add label 'is_active' to metric 'gitea_users'feat: add label 'state' to metric 'gitea_users'Apr 30, 2025
@TheFox0x7
Copy link
Contributor

I'm not sure about making that change a part of this PR, since it would be a breaking change.

Sorry, I didn't look that closely at the code and figured it's a new metric. In this case you're right, it's not worth breaking here, I've been meaning to clean this up anyway (whenever I finally set my infrastructure up to actually gather and see those...) so I'll look at doing this then.

tobiasbp reacted with thumbs up emoji

@lunny
Copy link
Member

How about keep the old metric as total users and added a newactive users, removing theinactive users.

@lunnylunny added this to the1.25.0 milestoneApr 30, 2025
@lunnylunny added the type/enhancementAn improvement of existing functionality labelApr 30, 2025
@TheFox0x7
Copy link
Contributor

I get that would be fully backwards compatible but it feels wrong to do IMO.
gitea_users still has the total user amount here - it's just split between user states (active/inactive). Those are directly linked to the metrics itself so label. You still can get the old amount by summing.
Contrast it withgitea_users,gitea_users_inactive and the derived active users:gitea_users - gitea_users_inactive.

Also labels better show links between metrics, than having two separate ones.

@techknowlogicktechknowlogick added the pr/breakingMerging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! labelMay 1, 2025
@techknowlogick
Copy link
Member

Added the "breaking" label to make sure we mention this in release notes. FWIW I think this change is beneficial and should be included. If it's not done in a backwards compatible way, that's probably ok since we have a process for alerting users.

@tobiasbp
Copy link
ContributorAuthor

I get that would be fully backwards compatible but it feels wrong to do IMO.

I agree. It's much cleaner to keep the current metric and just add the label.

@tobiasbp
Copy link
ContributorAuthor

Added the "breaking" label to make sure we mention this in release notes.

Adding a label is not a breaking change. If a user does not specify a label, they get the current value (the total number of user accounts).

@TheFox0x7
Copy link
Contributor

I might be misremembering but don't they get both metrics separately and you need to sum them to get the total number?

@tobiasbp
Copy link
ContributorAuthor

I might be misremembering but don't they get both metrics separately and you need to sum them to get the total number?

Actually, I think you and@techknowlogick are right. Adding thelabelis a breaking change since users would get two metrics, and would need to sum to get to the current value (as you describe).

@tobiasbp
Copy link
ContributorAuthor

Do you think we need any changes made to this PR?

@GiteaBotGiteaBot added lgtm/need 1This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelsMay 7, 2025
@techknowlogicktechknowlogickenabled auto-merge (squash)May 7, 2025 17:35
@techknowlogicktechknowlogick added the reviewed/wait-mergeThis pull request is part of the merge queue. It will be merged soon. labelMay 7, 2025
@GiteaBotGiteaBot added lgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1This PR needs approval from one additional maintainer to be merged. labelsMay 7, 2025
@techknowlogicktechknowlogick merged commit020e774 intogo-gitea:mainMay 7, 2025
26 checks passed
@GiteaBotGiteaBot removed the reviewed/wait-mergeThis pull request is part of the merge queue. It will be merged soon. labelMay 7, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull requestMay 9, 2025
* giteaofficial/main:  [skip ci] Updated translations via Crowdin  Fix autofocus behavior (go-gitea#34397)  Fix incorrect divergence cache after switching default branch (go-gitea#34370)  Add a button editing action secret (go-gitea#34348)  Fix LFS file not stored in LFS when uploaded/edited via API or web UI (go-gitea#34367)  [skip ci] Updated translations via Crowdin  Fix "The sidebar of the repository file list does not have a fixed heightgo-gitea#34298" (go-gitea#34321)  feat: add label 'state' to metric 'gitea_users' (go-gitea#34326)  Update JS and PY dependencies (go-gitea#34391)  Upgrade go-github v61 -> v71 (go-gitea#34385)  Bump `@github/relative-time-element` to v4.4.7 (go-gitea#34384)  gitignore: Visual Studio settings folder (go-gitea#34375)  Grey out expired artifact on Artifacts list (go-gitea#34314)
saschazepter pushed a commit to saschazepter/forgejo that referenced this pull requestJun 27, 2025
## Checklist- [x] go to the last cherry-pick PR (forgejo/forgejo#7804) to figure out how far it went: [gitea@a2024953c5](go-gitea/gitea@a202495)- [x] cherry-pick and open PR (forgejo/forgejo#7909)- [ ] have the PR pass the CI- end-to-end (specially important if there are actions related changes)  - [ ] add `run-end-to-end` label  - [ ] check the result- [ ] write release notes- [ ] assign reviewers- [ ] 48h later, last call- merge 1 hour after the last call## Legend- ❓ - No decision about the commit has been made.- 🍒 - The commit has been cherry picked.- ⏩ - The commit has been skipped.- 💡 - The commit has been skipped, but should be ported to Forgejo.- ✍️ - The commit has been skipped, and a port to Forgejo already exists.## Commits- 🍒 [`gitea`](go-gitea/gitea@e92c4f1) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/56fa2caef32c4b0e5017f4b09188ad1dfc8d3603) Add missing setting load in dump-repo command ([gitea#34479](go-gitea/gitea#34479))- 🍒 [`gitea`](go-gitea/gitea@7b518bc) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/6e5299606a1bd42cb45ed472a84ba797cf2fa790) Change "rejected" to "changes requested" in 3rd party PR review notification ([gitea#34481](go-gitea/gitea#34481))## TODO- 💡 [`gitea`](go-gitea/gitea@9723810) Fix url validation in webhook add/edit API ([gitea#34492](go-gitea/gitea#34492))  Relevant input validation but test needs more backport.------- 💡 [`gitea`](go-gitea/gitea@59df03b) Fix get / delete runner to use consistent http 404 and 500 status ([gitea#34480](go-gitea/gitea#34480))  It may be relevant to Forgejo as well------- 💡 [`gitea`](go-gitea/gitea@1e2f351) Add endpoint deleting workflow run ([gitea#34337](go-gitea/gitea#34337))  Actions, it would be worth having in Forgejo as well.------- 💡 [`gitea`](go-gitea/gitea@5cb4cbf) Fix repo broken check ([gitea#34444](go-gitea/gitea#34444))  Check wether this is relevant to us, port if yes.------- 💡 [`gitea`](go-gitea/gitea@355e9a9) Add a webhook push test for dev branch ([gitea#34421](go-gitea/gitea#34421))  Enhances webhook integration tests.------- 💡 [`gitea`](go-gitea/gitea@34281bc) Fix bug webhook milestone is not right. ([gitea#34419](go-gitea/gitea#34419))  Testcode diverged, port required.------- 💡 [`gitea`](go-gitea/gitea@780e92e) Only git operations should update `last changed` of a repository ([gitea#34388](go-gitea/gitea#34388))  Port required, would benefit from additional tests.------- 💡 [`gitea`](go-gitea/gitea@b07e039) When updating comment, if the content is the same, just return and not update the databse ([gitea#34422](go-gitea/gitea#34422))  Codebase diverged, port required.------- 💡 [`gitea`](go-gitea/gitea@71a1187) Fix incorrect divergence cache after switching default branch ([gitea#34370](go-gitea/gitea#34370))  Depends on previous gitea changes, port needed.------- 💡 [`gitea`](go-gitea/gitea@4c611bf) Add a button editing action secret ([gitea#34348](go-gitea/gitea#34348))  This is an interesting feature and it has tests as well. Feature request covering this:https://codeberg.org/forgejo/forgejo/issues/7882------- 💡 [`gitea`](go-gitea/gitea@2fbc8f9) Fix LFS file not stored in LFS when uploaded/edited via API or web UI ([gitea#34367](go-gitea/gitea#34367))  Our code diverged - pls. check relevance & maybe port.------- 💡 [`gitea`](go-gitea/gitea@020e774) feat: add label 'state' to metric 'gitea_users' ([gitea#34326](go-gitea/gitea#34326))  Adjust our existing tests while porting this.------## Skipped- ⏩ [`gitea`](go-gitea/gitea@ec10c6b) [skip ci] Updated translations via Crowdin------- ⏩ [`gitea`](go-gitea/gitea@d89eed9) Fix edithook api can not update package, status and workflow_job events ([gitea#34495](go-gitea/gitea#34495))  - gitea actions specific specific------- ⏩ [`gitea`](go-gitea/gitea@b6c0667)  Add R-HNF to the TRANSLATORS file ([gitea#34494](go-gitea/gitea#34494))  - gitea translators update specific------- ⏩ [`gitea`](go-gitea/gitea@6fbf0e6) nix flake update ([gitea#34476](go-gitea/gitea#34476))  - gitea dependency update specific------- ⏩ [`gitea`](go-gitea/gitea@c24f4b3) Add migrations tests ([gitea#34456](go-gitea/gitea#34456))------- ⏩ [`gitea`](go-gitea/gitea@bf338bb) Fix project board view ([gitea#34470](go-gitea/gitea#34470))  - gitea ui specific specific------- ⏩ [`gitea`](go-gitea/gitea@319d03f) [skip ci] Updated translations via Crowdin------- ⏩ [`gitea`](go-gitea/gitea@dd500ce) Fix Workflow run Not Found page ([gitea#34459](go-gitea/gitea#34459))  - gitea actions specific specific------- ⏩ [`gitea`](go-gitea/gitea@b6bf128) [skip ci] Updated translations via Crowdin------- ⏩ [`gitea`](go-gitea/gitea@a0595ad) Fix remove org user failure on mssql ([gitea#34449](go-gitea/gitea#34449))------- ⏩ [`gitea`](go-gitea/gitea@b5fd3e7) Fix comment textarea scroll issue in Firefox ([gitea#34438](go-gitea/gitea#34438))  - gitea ui specific specific------- ⏩ [`gitea`](go-gitea/gitea@4011e22) Fix releases sidebar navigation link ([gitea#34436](go-gitea/gitea#34436))  - gitea ui specific specific------- ⏩ [`gitea`](go-gitea/gitea@0902d42) [skip ci] Updated translations via Crowdin------- ⏩ [`gitea`](go-gitea/gitea@4a98ab0) Remove legacy template helper functions ([gitea#34426](go-gitea/gitea#34426))  - gitea specific specific------- ⏩ [`gitea`](go-gitea/gitea@9b8609e) Fix GetUsersByEmails ([gitea#34423](go-gitea/gitea#34423))  - gitea specific specific------- ⏩ [`gitea`](go-gitea/gitea@0f63a5e) [skip ci] Updated translations via Crowdin------- ⏩ [`gitea`](go-gitea/gitea@ad27144) Fix a bug when uploading file via lfs ssh command ([gitea#34408](go-gitea/gitea#34408))  :skiP: present with PR #7752------- ⏩ [`gitea`](go-gitea/gitea@8b16ab7) Merge and tweak markup editor expander CSS ([gitea#34409](go-gitea/gitea#34409))  - gitea ui specific specific------- ⏩ [`gitea`](go-gitea/gitea@2ecd73d) Bump `@github/relative-time-element` to v4.4.8 ([gitea#34413](go-gitea/gitea#34413))  - gitea dependency update specific------- ⏩ [`gitea`](go-gitea/gitea@179068f) Refactor commit message rendering and fix bugs ([gitea#34412](go-gitea/gitea#34412))  - gitea ui specific specific------- ⏩ [`gitea`](go-gitea/gitea@44aadc3) [skip ci] Updated translations via Crowdin------- ⏩ [`gitea`](go-gitea/gitea@f63822f) Fix autofocus behavior ([gitea#34397](go-gitea/gitea#34397))  - gitea ui specific specific------- ⏩ [`gitea`](go-gitea/gitea@82071ee) [skip ci] Updated translations via Crowdin------- ⏩ [`gitea`](go-gitea/gitea@bbfc21e) Fix "The sidebar of the repository file list does not have a fixed height #34298" ([gitea#34321](go-gitea/gitea#34321))  - gitea ui specific specific------- ⏩ [`gitea`](go-gitea/gitea@dd886d7) Update JS and PY dependencies ([gitea#34391](go-gitea/gitea#34391))  - gitea dependency update specific------- ⏩ [`gitea`](go-gitea/gitea@2a660b4) Upgrade go-github v61 -> v71 ([gitea#34385](go-gitea/gitea#34385))  - gitea dependency update specific------- ⏩ [`gitea`](go-gitea/gitea@6bd8fe5) Bump `@github/relative-time-element` to v4.4.7 ([gitea#34384](go-gitea/gitea#34384))  - gitea dependency update specific------<details><summary><h2>Stats</h2></summary><br>Between [`gitea@a2024953c5`](go-gitea/gitea@a202495) and [`gitea@ec10c6ba5a`](go-gitea/gitea@ec10c6b), **41** commits have been reviewed. We picked **2**, skipped **27**, and decided to port **12**.</details>Co-authored-by: Sebastian Weigand <s.weigand.phy@gmail.com>Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>Reviewed-on:https://codeberg.org/forgejo/forgejo/pulls/7909Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
@go-giteago-gitea locked asresolvedand limited conversation to collaboratorsAug 6, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@lunnylunnylunny approved these changes

@techknowlogicktechknowlogicktechknowlogick approved these changes

Assignees

No one assigned

Labels

lgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore.modifies/goPull requests that update Go codepr/breakingMerging this PR means builds will break. Needs a description what exactly breaks, and how to fix it!type/enhancementAn improvement of existing functionality

Projects

None yet

Milestone

1.25.0

Development

Successfully merging this pull request may close these issues.

Add label 'is_active' to 'gitea_users' metric.

5 participants

@tobiasbp@TheFox0x7@lunny@techknowlogick@GiteaBot

[8]ページ先頭

©2009-2025 Movatter.jp