movio / bramble

A federated GraphQL API gateway
https://movio.github.io/bramble/
MIT License
498 stars 55 forks source link

Instrumentation as a Plugin #277

Open Quantumplation opened 2 months ago

Quantumplation commented 2 months ago

Bramble currently exposes Prometheus metrics; I'd like to replace this with CloudWatch metrics instead.

Would it make sense to refactor instrumentation.go so that it operated as a plugin, so that users could configure a different metrics backends instead?

pkqk commented 2 months ago

Hi @Quantumplation,

There's not much in instrumentation.go that's mostly some helpers to build up log output for request events. metrics.go has the prometheus implementation.

It could be refactored to allow plugging in another metrics implementation. As a first draft idea I think having a plugin return a metrics implementation interface (so the main plugin interface only needs one new method added) and that interface could then mirror the current metrics collection calls.

It does also look like you could use cloudwatch_exporter or something similar.