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: add prometheus metrics evaluation example #677

Conversation

shardulsrivastava
Copy link
Contributor

@shardulsrivastava shardulsrivastava commented Jan 23, 2023

Signed-off-by: Shardul Srivastava [email protected]

Adds a simple function for fetching metrics from Prometheus and evaluates them against a specified expected value.

Closes #65

@shardulsrivastava shardulsrivastava changed the title feature: add prometheus metrics evaluation example feat: add prometheus metrics evaluation example Jan 23, 2023
@shardulsrivastava shardulsrivastava force-pushed the feature/65/add-prometheus-metrics-function branch from 378e5fc to db8a3f5 Compare January 23, 2023 03:01
@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Merging #677 (8cf1224) into main (a3b0f7b) will increase coverage by 1.02%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #677      +/-   ##
==========================================
+ Coverage   56.36%   57.38%   +1.02%     
==========================================
  Files          82       89       +7     
  Lines        6683     7012     +329     
==========================================
+ Hits         3767     4024     +257     
- Misses       2756     2822      +66     
- Partials      160      166       +6     
Impacted Files Coverage Δ
...ator/controllers/metrics/keptnmetric_controller.go 65.62% <0.00%> (-1.05%) ⬇️
klt-cert-manager/kubeutils/query.go 100.00% <0.00%> (ø)
operator/apis/lifecycle/v1alpha2/common/common.go 100.00% <0.00%> (ø)
...perator/apis/metrics/v1alpha1/keptnmetric_types.go 100.00% <0.00%> (ø)
...ontrollers/lifecycle/keptnevaluation/controller.go 81.28% <0.00%> (ø)
...rs/keptnwebhookcontroller/webhook_configuration.go 100.00% <0.00%> (ø)
operator/cmd/config/config.go 40.00% <0.00%> (ø)
...tor/cmd/metrics/adapter/provider/custom_metrics.go 100.00% <0.00%> (ø)
operator/controllers/common/providers/common.go 100.00% <0.00%> (ø)
operator/cmd/webhook/builder.go 25.00% <0.00%> (ø)
... and 7 more
Flag Coverage Δ
component-tests 53.19% <ø> (+0.35%) ⬆️
keptn-cert-manager ?
keptn-lifecycle-operator 53.10% <ø> (+1.08%) ⬆️
klt-cert-manager 67.50% <ø> (?)
scheduler 21.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@thisthat thisthat 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 @shardulsrivastava for your PR. I left few nits

functions-runtime/samples/ts/prometheus.ts Outdated Show resolved Hide resolved
functions-runtime/samples/ts/prometheus.ts Outdated Show resolved Hide resolved
functions-runtime/samples/ts/prometheus.ts Outdated Show resolved Hide resolved
functions-runtime/samples/ts/prometheus.ts Outdated Show resolved Hide resolved
functions-runtime/samples/ts/prometheus.ts Outdated Show resolved Hide resolved
@shardulsrivastava shardulsrivastava force-pushed the feature/65/add-prometheus-metrics-function branch from f089830 to 83337c3 Compare January 28, 2023 17:39
@shardulsrivastava
Copy link
Contributor Author

@thisthat thanks for the review, I have addressed them and also added some error handling which i encountered during testing.

Signed-off-by: Shardul Srivastava <[email protected]>
Signed-off-by: Shardul Srivastava <[email protected]>
Signed-off-by: Shardul Srivastava <[email protected]>
Signed-off-by: Shardul Srivastava <[email protected]>
@shardulsrivastava shardulsrivastava force-pushed the feature/65/add-prometheus-metrics-function branch from 606c761 to f66d4b4 Compare January 29, 2023 20:23
@thisthat
Copy link
Member

@shardulsrivastava thanks for the PR 👍 I have only a small final Nit to fix

Co-authored-by: Giovanni Liva <[email protected]>
Signed-off-by: Shardul Srivastava <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@shardulsrivastava
Copy link
Contributor Author

@thisthat addressed the comment.

@thisthat thisthat merged commit e5f644c into keptn:main Feb 1, 2023
@keptn-bot keptn-bot mentioned this pull request Feb 1, 2023
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.

Create simple function for fetching metrics from prometheus
3 participants