I'm curious about this Prometheus, can I develop a Grafana with Prometheus as a data source with fastapi URL? Right now I'm developing on Grafana monitoring dashboard and I have an API using fastapi and I'm using this API as a data source with SimpleJSON plugin on Grafana. But now I'm a little curious about this Prometheus, is it possible to use my API as a Prometheus data source? If so, what endpoint that I should provide? For now for SimpleJSON Plugin it required /, /search and /query. How about Prometheus data sources?
Many Thanks
"Data source" means something specific in Grafana. Prometheus data source has a well defined path for its queries; you can't modify that. There is an HTTP JSON+API datasource for Grafana if you search its plugins - https://marcus.se.net/grafana-json-datasource/
However, that's completely bypassing Prometheus longer-term storage. Prometheus reads scrape targets, then collects and aggregates that.
To do so, your API would need to expose any route that returns Prometheus "exposition format", not JSON. This route is put in the Prometheus config file, not into Grafana anywhere.
While Prometheus can load random data, it's better to use Counter, Guage, etc types it expects
The OpenTelemetry project should be able to be used in any framework, and there are examples in their documentation for the Python module.
If your goal is to just get any data, not metrics, into Grafana, using an RDBMS or Mongodb, or other supported data sources might be better