MCPcopy
hub / github.com/grafana/tempo / NewURLDenyListWare

Function NewURLDenyListWare

modules/frontend/pipeline/async_deny_list_middleware.go:15–32  ·  view source on GitHub ↗
(denyList []string)

Source from the content-addressed store, hash-verified

13}
14
15func NewURLDenyListWare(denyList []string) AsyncMiddleware[combiner.PipelineResponse] {
16 compiledDenylist := make([]*regexp.Regexp, 0)
17 for _, v := range denyList {
18 r, err := regexp.Compile(v)
19 if err == nil {
20 compiledDenylist = append(compiledDenylist, r)
21 } else {
22 panic(fmt.Sprintf("error compiling query frontend deny list regex: %s", err))
23 }
24 }
25
26 return AsyncMiddlewareFunc[combiner.PipelineResponse](func(next AsyncRoundTripper[combiner.PipelineResponse]) AsyncRoundTripper[combiner.PipelineResponse] {
27 return &urlDenylistWare{
28 next: next,
29 denyList: compiledDenylist,
30 }
31 })
32}
33
34func (c urlDenylistWare) RoundTrip(req Request) (Responses[combiner.PipelineResponse], error) {
35 if len(c.denyList) != 0 {

Calls

no outgoing calls