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

Webhook exporter allowing Pelorus to work with push data model #836

Merged
merged 2 commits into from
Mar 3, 2023

Conversation

mpryc
Copy link
Collaborator

@mpryc mpryc commented Feb 6, 2023

Check README.md in the webhook folder.

Testing

Some testing instructions:

On one terminal:

$ make dev-env
$ source .venv/bin/activate
$ cd exporters/webhook
$ uvicorn app:app

On another terminal

$ cd exporters/tests/data
$ curl -X POST http://localhost:8000/pelorus/webhook -d @./webhook_pelorus_committime.json -H "Content-Type: application/json" -H "User-Agent: Pelorus-Webhook/test" -H "X-Pelorus-Event: committime"
$ curl -X POST http://localhost:8000/pelorus/webhook -d @./webhook_pelorus_deploytime.json -H "Content-Type: application/json" -H "User-Agent: Pelorus-Webhook/test" -H "X-Pelorus-Event: deploytime"
$ curl -X POST http://localhost:8000/pelorus/webhook -d @./webhook_pelorus_failure_created.json -H "Content-Type: application/json" -H "User-Agent: Pelorus-Webhook/test" -H "X-Pelorus-Event: failure"
$ curl -X POST http://localhost:8000/pelorus/webhook -d @./webhook_pelorus_failure_resolved.json -H "Content-Type: application/json" -H "User-Agent: Pelorus-Webhook/test" -H "X-Pelorus-Event: failure"

Navigate to the endpoint: http://localhost:8000/metrics, you should see all the metrics collected:

# HELP commit_timestamp Commit timestamp
# TYPE commit_timestamp gauge
commit_timestamp{app="mongo-todolist",commit_hash="5379bad65a3f83853a75aabec9e0e43c75fd18fc",image_sha="sha256:af4092ccbfa99a3ec1ea93058fe39b8ddfd8db1c7a18081db397c50a0b8ec77d",namespace="mongo-persistent"} 1.557933657e+09
# HELP deploy_timestamp Deployment timestamp
# TYPE deploy_timestamp gauge
deploy_timestamp{app="mongo-todolist",image_sha="sha256:af4092ccbfa99a3ec1ea93058fe39b8ddfd8db1c7a18081db397c50a0b8ec77d",namespace="mongo-persistent"} 1.557933657e+09
# HELP failure_creation_timestamp Failure Creation Timestamp
# TYPE failure_creation_timestamp gauge
failure_creation_timestamp{app="mongo-todolist",failure_id="MONGO-1"} 1.557933657e+09
# HELP failure_resolution_timestamp Failure Resolution Timestamp
# TYPE failure_resolution_timestamp gauge
failure_resolution_timestamp{app="mongo-todolist",failure_id="MONGO-1"} 1.557933657e+09

Also for testing a simple make unit-tests should do most of the job, as the coverage for the new functions is almost at 100%.

Signed-off-by: Michal Pryc mpryc@redhat.com

@redhat-cop/mdt

@mpryc mpryc requested a review from weshayutin February 6, 2023 17:18
@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes labels Feb 6, 2023
@openshift-ci
Copy link

openshift-ci bot commented Feb 6, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@mpryc mpryc force-pushed the webhook_playground branch from 6ea110d to d18b63c Compare February 7, 2023 09:49
@weshayutin weshayutin mentioned this pull request Feb 22, 2023
10 tasks
@mpryc mpryc force-pushed the webhook_playground branch from d18b63c to 0f4e18a Compare February 27, 2023 18:24
@mpryc mpryc force-pushed the webhook_playground branch from 0f4e18a to 530ece9 Compare March 1, 2023 13:22
@mpryc mpryc force-pushed the webhook_playground branch 2 times, most recently from a4a1d5d to f3b332d Compare March 1, 2023 19:06
@mpryc mpryc changed the title DNM: The webhook PoC Webhook exporter allowing Pelorus to work with push data model Mar 1, 2023
Signed-off-by: Michal Pryc <mpryc@redhat.com>

Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
Signed-off-by: Michal Pryc <mpryc@redhat.com>
@mpryc mpryc force-pushed the webhook_playground branch from 82a9457 to af00ac6 Compare March 3, 2023 15:26
@mateusoliveira43 mateusoliveira43 self-assigned this Mar 3, 2023
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
Copy link
Collaborator

@mateusoliveira43 mateusoliveira43 left a comment

Choose a reason for hiding this comment

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

As discussed, the missing features will be implemented in following PRs, guided by the created issues

@openshift-ci
Copy link

openshift-ci bot commented Mar 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mateusoliveira43

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2023
@mateusoliveira43 mateusoliveira43 merged commit b28a339 into dora-metrics:master Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants