Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Task queue webhook #262

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Task queue webhook #262

merged 1 commit into from
Jan 15, 2024

Conversation

irevoire
Copy link
Member

@irevoire irevoire commented Jan 3, 2024

Original PRD: https://www.notion.so/meilisearch/Task-Queue-Webhook-2c9ff1c6b820489399194539d37c4d11

Summary

Introduce a configuration for a webhook url that will be called whenever a task finishes so a third party can be notified. It will be used to compute some of the required metrics for the Monitoring Metrics v1 project.


Changes

  • The webhook URL is configured either via the env var MEILI_TASK_WEBHOOK_URL or via the CLI option flag --task-webhook-url
    • By default, the webhook URL value is empty.
    • If the given value does not match a valid URL format, a human-readable error is returned to the user and the engine does not start.
    • A valid user-provided URL is kept as is.
    • You can optionally set an Authorization header by using the --task-webhook-authorization-header CLI option flag or via the MEILI_TASK_WEBHOOK_AUTHORIZATION_HEADER env var.
  • When a valid webhook URL is configured and when a batch of tasks reaches a finished status (status: succeeded/failed), the engine sends a POST request to the user-configured webhook URL. The HTTP request contains the finished tasks in its payload.
    • The sent payload is compressed with gzip and represented in the JSON Lines text format.
  • A task sent over the webhook URL matches the task object definition.
  • Payload example
    • In that case, the user configured https://myproject.com/mywebhook?common=people
//POST HTTP request to https://myproject.com/mywebhook?common=people

{"uid":4,"indexUid":"movie","status":"failed","type":"indexDeletion","canceledBy":null,"details.deletedDocuments":0,"error.message":"Index `movie` not found.","error.code":"index_not_found","error.type":"invalid_request","error.link":"https://docs.meilisearch.com/errors#index_not_found","duration":"PT0.001192S","enqueuedAt":"2022-08-04T12:28:15.159167Z","startedAt":"2022-08-04T12:28:15.161996Z","finishedAt":"2022-08-04T12:28:15.163188Z"}
{"uid":5,"indexUid":"movie","status":"failed","type":"indexDeletion","canceledBy":null,"details.deletedDocuments":0,"error.message":"Index `movie` not found.","error.code":"index_not_found","error.type":"invalid_request","error.link":"https://docs.meilisearch.com/errors#index_not_found","duration":"PT0.001192S","enqueuedAt":"2022-08-04T12:28:15.159167Z","startedAt":"2022-08-04T12:28:15.161996Z","finishedAt":"2022-08-04T12:28:15.163188Z"}
{"uid":6,"indexUid":"movie","status":"failed","type":"indexDeletion","canceledBy":null,"details.deletedDocuments":0,"error.message":"Index `movie` not found.","error.code":"index_not_found","error.type":"invalid_request","error.link":"https://docs.meilisearch.com/errors#index_not_found","duration":"PT0.001192S","enqueuedAt":"2022-08-04T12:28:15.159167Z","startedAt":"2022-08-04T12:28:15.161996Z","finishedAt":"2022-08-04T12:28:15.163188Z"}

Misc

  • Update telemetry datapoints (if needed; Apply the Telemetry label)

@irevoire irevoire added In Progress Feature specification is in elaboration. Important changes can still occurs in the specification. Implemented Feature specification has been implemented. Telemetry Update the telemetry collect. labels Jan 3, 2024
@irevoire irevoire force-pushed the task-queue-webhook branch from 9800ac2 to a9636b4 Compare January 3, 2024 10:36
@irevoire irevoire requested a review from macraig January 3, 2024 10:36
@irevoire irevoire marked this pull request as ready for review January 3, 2024 10:36
@irevoire irevoire added Ready For Review Feature specification must be reviewed. and removed In Progress Feature specification is in elaboration. Important changes can still occurs in the specification. labels Jan 3, 2024
Copy link
Contributor

@macraig macraig left a comment

Choose a reason for hiding this comment

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

LGTM!

@macraig macraig changed the base branch from main to release-v1.6.0 January 15, 2024 19:25
@macraig macraig merged commit f1bb7e8 into release-v1.6.0 Jan 15, 2024
2 checks passed
@macraig macraig deleted the task-queue-webhook branch January 15, 2024 19:25
macraig added a commit that referenced this pull request Jan 15, 2024
* Bump API version

* Add proximity precision setting (#261)

* Add proximity precision setting

* Update text/0034-telemetry-policies.md

Co-authored-by: Maria Craig <maria@meilisearch.com>

* Update text/0034-telemetry-policies.md

Co-authored-by: Maria Craig <maria@meilisearch.com>

* Update text/0034-telemetry-policies.md

Co-authored-by: Maria Craig <maria@meilisearch.com>

* Update text/0123-settings-api.md

* Update text/0123-proximity-precision.md

* Update text/0123-proximity-precision.md

---------

Co-authored-by: Maria Craig <maria@meilisearch.com>

* write the task queue webhook specification (#262)

---------

Co-authored-by: María <maria@Marias-MacBook-Pro.local>
Co-authored-by: Many the fish <legendre.maxime.isn@gmail.com>
Co-authored-by: Tamo <tamo@meilisearch.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Implemented Feature specification has been implemented. Ready For Review Feature specification must be reviewed. Telemetry Update the telemetry collect.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants