[FEATURE] - Add Prometheus Metrics For Job
We can add prometheus metrics for job execution.Then outside monitor system can use these metrics to track jobs. Maybe I can send a pr.
I think having optionally enabled prometheus metrics could be a nice a feature to add.
metrics collector (counter,summary...)should always track job's state.
metrics exporter could be a function like gocron.MetricsServe(ListenPort,Path)
Yeah. It'd be nice to make the metrics an interface so we can implement with prometheus now and then later it could be implemented with influx and others.
Please weigh in if you have input on what sort of metrics you'd like to see from gocron -> https://github.com/go-co-op/gocron/pull/417#discussion_r1174015307
I think it’d be ideal to use otel like https://github.com/open-telemetry/opentelemetry-go/blob/main/example/prometheus/main.go
Agreed that we may use OTEL to export the inner tracing data since gocron is a library instead of a service. For the metrics like the Prometheus, should be exported by the user service itself, and you can request gocron to export the way to get the metric's value you want, like the number of scheduling jobs, and so on.
If anyone is looking to work on implementing this, what I'd like to see is:
- An interface for the metrics provider defined in gocron
- This keeps the dependency for metrics out of gocron and only add the dependency if the user imports the specific metrics implementation gocron repo (same pattern that is used for the distributed locker)
- This should have some reasonable methods for incrementing metrics like counters with labels
- A separate repository for each provider implementation
- I would think either OTEL or Prometheus directly first
- OTEL enables a broad scope of metrics providers and so it may be enough to implement only OTEL