alloy
alloy copied to clipboard
Live debugging service with prometheus.relabel
THIS PR WILL BE MERGED TO A FEATURE BRANCH WHICH WILL RECEIVE A FEW OTHER PRs BEFORE BEING READY TO BE MERGED ON MAIN
This PR is the first part of the live debugging functionality.
It creates live debugging as a service and connects the prometheus.relabel component to it (an easy first candidate).
A stream to a component can be opened via http://localhost:12345/api/v0/web/debug/ + componentID.
This adds a callback to the x-ray service that the component can retrieve and use to pass data as a string which will be directly flushed to the HTTP client.
It supports components that are inside modules.
Fixes #790
Looks reasonable, tested both wide 1,000 streams and deep 1 stream with 1m metrics. Long term some changes around when to flush and the channel would be nice. But performance is totally reasonable.
@ptodev @thampiotr thanks for your feedback! I made some changes to try to improve naming and readability. I also split the interface in two: DebugCallbackRegistry and DebugDataPublisher. I'm now using two interfaces to clearly separate the roles between the debug data publishers (the components) and the API that sets the callbacks. I'm not sure where these interfaces should be defined so I left them in the livedebugging package. Please have another look at it when you have time :)