|
1 | 1 | package eds |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "context" |
4 | 5 | "fmt" |
5 | | - "time" |
6 | | - |
7 | | - "github.com/gojektech/consul-envoy-xds/agent" |
8 | | - "github.com/gojektech/consul-envoy-xds/pubsub" |
9 | | - |
10 | 6 | "log" |
| 7 | + "time" |
11 | 8 |
|
12 | 9 | cp "github.com/envoyproxy/go-control-plane/envoy/api/v2" |
13 | 10 | cpcore "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" |
14 | 11 | eds "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" |
15 | 12 | "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" |
| 13 | + "github.com/gojektech/consul-envoy-xds/agent" |
| 14 | + "github.com/gojektech/consul-envoy-xds/eventctx" |
| 15 | + "github.com/gojektech/consul-envoy-xds/instrument" |
| 16 | + "github.com/gojektech/consul-envoy-xds/pubsub" |
16 | 17 | "github.com/hashicorp/consul/api" |
17 | 18 | "github.com/hashicorp/consul/watch" |
18 | 19 | ) |
@@ -126,8 +127,11 @@ func (s *service) WatchPlan(publish func(*pubsub.Event)) (*watch.Plan, error) { |
126 | 127 | return nil, err |
127 | 128 | } |
128 | 129 | plan.Handler = func(idx uint64, data interface{}) { |
| 130 | + txn := instrument.NewRelicApp().StartTransaction("watch", nil, nil) |
| 131 | + defer txn.End() |
129 | 132 | log.Println(fmt.Sprintf("consul watch triggerred: %v", data)) |
130 | | - publish(&pubsub.Event{CLA: s.CLA(), Clusters: s.Clusters(), Routes: s.Routes()}) |
| 133 | + ctx := eventctx.SetNewRelicTxn(context.Background(), txn) |
| 134 | + publish(&pubsub.Event{Context: ctx, CLA: s.CLA(), Clusters: s.Clusters(), Routes: s.Routes()}) |
131 | 135 | } |
132 | 136 | return plan, nil |
133 | 137 | } |
|
0 commit comments