determined icon indicating copy to clipboard operation
determined copied to clipboard

feat: Implement custom trigger for webhooks

Open gt2345 opened this issue 1 year ago • 2 comments

Ticket

Description

Part of workload alerting project. ERD link: https://hpe-aiatscale.atlassian.net/wiki/spaces/ENGINEERIN/pages/1666809868/Workload+Alerting+ERD

Implement trigger type CUSTOM for webhook.

Test Plan

Create a webhook with custom trigger, note that for custom trigger, the mode of webhook can only be Specific. Within the same workspace as the webhook, create an experiment with config including

integrations:
  webhooks:
    webhook_name:
      - the_name_of_custom_webhook

In the experiment code, trigger the webhook as

with det.core.init() as core_context:
    core_context.alert(title="some content", level="debug")

Verify that the webhook is triggered.

Checklist

  • [ ] Changes have been manually QA'd
  • [ ] New features have been approved by the corresponding PM
  • [ ] User-facing API changes have the "User-facing API Change" label
  • [ ] Release notes have been added as a separate file under docs/release-notes/ See Release Note for details.
  • [ ] Licenses have been included for new code which was copied and/or modified from any external code

gt2345 avatar Aug 29 '24 15:08 gt2345

Codecov Report

Attention: Patch coverage is 3.34928% with 202 lines in your changes missing coverage. Please review.

Project coverage is 54.61%. Comparing base (036477b) to head (f72241e). Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
master/internal/webhooks/postgres_webhook.go 4.23% 113 Missing :warning:
webui/react/src/components/WebhookCreateModal.tsx 0.00% 43 Missing :warning:
master/internal/webhooks/api_webhook.go 0.00% 21 Missing :warning:
harness/determined/core/_context.py 12.50% 14 Missing :warning:
webui/react/src/pages/WebhookList.tsx 0.00% 7 Missing :warning:
master/internal/webhooks/webhook.go 0.00% 4 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9879      +/-   ##
==========================================
- Coverage   54.67%   54.61%   -0.07%     
==========================================
  Files        1263     1263              
  Lines      156862   157047     +185     
  Branches     3597     3598       +1     
==========================================
+ Hits        85768    85769       +1     
- Misses      70963    71147     +184     
  Partials      131      131              
Flag Coverage Δ
backend 45.08% <3.49%> (-0.12%) :arrow_down:
harness 72.58% <12.50%> (-0.04%) :arrow_down:
web 54.40% <0.00%> (-0.03%) :arrow_down:

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

Files with missing lines Coverage Δ
master/internal/webhooks/webhook.go 12.00% <0.00%> (-0.50%) :arrow_down:
webui/react/src/pages/WebhookList.tsx 0.00% <0.00%> (ø)
harness/determined/core/_context.py 53.04% <12.50%> (-4.67%) :arrow_down:
master/internal/webhooks/api_webhook.go 0.00% <0.00%> (ø)
webui/react/src/components/WebhookCreateModal.tsx 0.00% <0.00%> (ø)
master/internal/webhooks/postgres_webhook.go 48.70% <4.23%> (-11.94%) :arrow_down:

... and 4 files with indirect coverage changes

codecov[bot] avatar Aug 29 '24 15:08 codecov[bot]

Deploy Preview for determined-ui canceled.

Name Link
Latest commit f72241e5b8a7d9855474abde18cec53bf780500b
Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/66db3c5625106600081cb6a8

netlify[bot] avatar Aug 29 '24 15:08 netlify[bot]