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

feat: Expose metrics about used TeamForCapella license usage #1387

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

MoritzWeber0
Copy link
Member

@MoritzWeber0 MoritzWeber0 commented Feb 28, 2024

A new gauge metric t4c_licenses was added to the /metrics endpoint, which contains the number of currently used licenses per TeamForCapella instance. The instance name is used as label for the metric.

Note: If you have multiple TeamForCapella server instances, which point to the same license server, this is not detected. Therefore, make sure to filter the t4c_licenses for one instance first.

Resolves #693.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 85.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 73.11%. Comparing base (21d4c9a) to head (98fc67e).
Report is 2 commits behind head on main.

Files Patch % Lines
...capellacollab/settings/modelsources/t4c/metrics.py 84.21% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1387      +/-   ##
==========================================
+ Coverage   72.99%   73.11%   +0.11%     
==========================================
  Files         164      165       +1     
  Lines        5451     5490      +39     
  Branches      618      624       +6     
==========================================
+ Hits         3979     4014      +35     
- Misses       1334     1335       +1     
- Partials      138      141       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MoritzWeber0 MoritzWeber0 reopened this Feb 28, 2024
@DSD-DBS DSD-DBS deleted a comment from sonarqubecloud bot Feb 28, 2024
@MoritzWeber0 MoritzWeber0 marked this pull request as ready for review February 28, 2024 16:02
@MoritzWeber0 MoritzWeber0 force-pushed the t4c-metrics branch 2 times, most recently from 5644ec2 to a6812e7 Compare February 29, 2024 12:58
Two new gauge metrics `used_t4c_licenses` and `total_t4c_licenses`
were added to the `/metrics` endpoint,
which contain the number of currently used and total licenses per TeamForCapella
instance. The instance name is used as label for the metric.

Note: If you have multiple TeamForCapella server instances, which point
to the same license server, this is not detected. Therefore, make sure to
filter the `t4c_licenses` for one instance first.
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@dominik003 dominik003 left a comment

Choose a reason for hiding this comment

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

LGTM! I was going to suggest using an (abstract) collector class, since the two collectors are very similar (and there is the possibility to outsource the retrieval of the instances), but apparently there is already such an abstract class in the Prometheus client, but starlett-prometheus uses a rather old version of it where it is not yet added.

@MoritzWeber0 MoritzWeber0 merged commit 0de2fbb into main Mar 5, 2024
26 checks passed
@MoritzWeber0 MoritzWeber0 deleted the t4c-metrics branch March 5, 2024 14:32
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.

Add T4C license consumption to /metrics endpoint.
2 participants