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

How do I subscribe to events? #75

Open
agardnerIT opened this issue Aug 17, 2024 · 1 comment
Open

How do I subscribe to events? #75

agardnerIT opened this issue Aug 17, 2024 · 1 comment

Comments

@agardnerIT
Copy link

agardnerIT commented Aug 17, 2024

I'm new to maestro and it looks great. I'm following the example workflow and can see the workflow executing in the logs with logs like this:

RunResponse(workflowId=sample-dag-test-1, workflowVersionId=1, workflowInstanceId=1, workflowRunId=1, workflowUuid=f5fd3577-a6b7-4ba5-9bdc-c80b36a02dcc,
status=WORKFLOW_RUN_CREATED,
timelineEvent=TimelineLogEvent(timestamp=1723858281027, level=INFO, message=Manually run a new workflow instance by a user [tester]), stepId=null, stepAttemptId=null

I want to "hook into" the "workflow finished" event then get the step + timing summary to reconstruct the run and perform my own logic.

For example:

  1. Workflow finished event received
  2. Use API to get all steps, execution status and timing

Then I can recreate something like this:

2024-08-17 10:00:00 INFO Workflow started
2024-08-17 10:02:00 INFO Step 1 started
2024-08-17 10:05:00 INFO Step 1 finished. Success.
2024-08-17 10:05:01 INFO Step 2 started
2024-08-17 10:05:01 INFO Step 3 started
2024-08-17 10:08:00 INFO Step 2 finished. Success.
2024-08-17 10:09:00 INFO Step 3 finished. Fail
2024-08-17 10:00:00 INFO Workflow finished

Any docs on how to achieve this? I can't see an OpenAPI URL so don't know the API endpoints.

Metrics / Prometheus

Digging deeper, I see lots of metrics are available in Cockroach and MaestroMetrics but there's no docs on how to access any of these: http://localhost:8080/_status/vars (as suggested by Cockroach) doesn't lead me anywhere.

@jun-he
Copy link
Contributor

jun-he commented Aug 19, 2024

@agardnerIT Yep, maestro is capable of publishing events for external systems. It depends on which mechanism your downstream service uses. Then you can implement MaestroNotificationPublisher interface. The current implementation is NoOpMaestroNotificationPublisher, which just prints out the events.

If you use Kafka or SNS, you can add a producer to send out the events. If you have a webservice, you can simply add a rest API call to pass the events to your service over a REST API.

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

No branches or pull requests

2 participants