forked from cloudfoundry/gorouter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
composite_reporter.go
41 lines (33 loc) · 1.03 KB
/
composite_reporter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package metrics
import (
"net/http"
"time"
"code.cloudfoundry.org/gorouter/metrics/reporter"
"code.cloudfoundry.org/gorouter/route"
)
type CompositeReporter struct {
first reporter.ProxyReporter
second reporter.ProxyReporter
}
func NewCompositeReporter(first, second reporter.ProxyReporter) reporter.ProxyReporter {
return &CompositeReporter{
first: first,
second: second,
}
}
func (c *CompositeReporter) CaptureBadRequest(req *http.Request) {
c.first.CaptureBadRequest(req)
c.second.CaptureBadRequest(req)
}
func (c *CompositeReporter) CaptureBadGateway(req *http.Request) {
c.first.CaptureBadGateway(req)
c.second.CaptureBadGateway(req)
}
func (c *CompositeReporter) CaptureRoutingRequest(b *route.Endpoint, req *http.Request) {
c.first.CaptureRoutingRequest(b, req)
c.second.CaptureRoutingRequest(b, req)
}
func (c *CompositeReporter) CaptureRoutingResponse(b *route.Endpoint, res *http.Response, t time.Time, d time.Duration) {
c.first.CaptureRoutingResponse(b, res, t, d)
c.second.CaptureRoutingResponse(b, res, t, d)
}