mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 05:02:35 +08:00
Plugins: Enhanced plugin instrumentation (#90199)
* Plugins: Enhanced plugin instrumentation * use backend.CallResourceResponseSenderFunc * sdk v0.237.0 * support admission control * cover all handlers in log and metrics middlewares * fix after review
This commit is contained in:

committed by
GitHub

parent
2a4a73e03d
commit
c8af659f02
@ -94,7 +94,7 @@ func (s *Service) CallResource(ctx context.Context, req *backend.CallResourceReq
|
||||
removeNonAllowedHeaders(req.Headers)
|
||||
|
||||
processedStreams := 0
|
||||
wrappedSender := callResourceResponseSenderFunc(func(res *backend.CallResourceResponse) error {
|
||||
wrappedSender := backend.CallResourceResponseSenderFunc(func(res *backend.CallResourceResponse) error {
|
||||
// Expected that headers and status are only part of first stream
|
||||
if processedStreams == 0 && res != nil {
|
||||
if len(res.Headers) > 0 {
|
||||
@ -354,9 +354,3 @@ func ensureContentTypeHeader(res *backend.CallResourceResponse) {
|
||||
res.Headers[contentTypeHeaderName] = []string{defaultContentType}
|
||||
}
|
||||
}
|
||||
|
||||
type callResourceResponseSenderFunc func(res *backend.CallResourceResponse) error
|
||||
|
||||
func (fn callResourceResponseSenderFunc) Send(res *backend.CallResourceResponse) error {
|
||||
return fn(res)
|
||||
}
|
||||
|
Reference in New Issue
Block a user