mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 12:52:05 +08:00

* Plugins: Refactor instrumentation as plugin client middleware * Simplify repeated code * Fix compilation error * Add comments * Moved status and endpoint consts to utils.go * Fix wrong endpoint name in CheckHealth InstrumentationMiddleware * Add tests * Fix wrong endpoint value in instrumentPluginRequestSize * removed todo * PR review feedback: use MustRegister * PR review feedback: move tracing middleware before instrumentation middleware * PR review feedback: removed decommissioned check * PR review feedback: extract prometheus metrics into separate variables
23 lines
536 B
Go
23 lines
536 B
Go
package clientmiddleware
|
|
|
|
import (
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
|
)
|
|
|
|
const (
|
|
statusOK = "ok"
|
|
statusError = "error"
|
|
statusCancelled = "cancelled"
|
|
|
|
endpointCallResource = "callResource"
|
|
endpointCheckHealth = "checkHealth"
|
|
endpointCollectMetrics = "collectMetrics"
|
|
endpointQueryData = "queryData"
|
|
)
|
|
|
|
type callResourceResponseSenderFunc func(res *backend.CallResourceResponse) error
|
|
|
|
func (fn callResourceResponseSenderFunc) Send(res *backend.CallResourceResponse) error {
|
|
return fn(res)
|
|
}
|