From 1a64060f2c0d9ada39c019709fed8725625b7708 Mon Sep 17 00:00:00 2001 From: Ox Cart Date: Thu, 19 Oct 2023 10:25:31 -0500 Subject: [PATCH] Send proxy_name to teleport --- http_proxy.go | 9 ++++----- otel/otel.go | 17 ++++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/http_proxy.go b/http_proxy.go index 32b4a24b..968d6d2d 100644 --- a/http_proxy.go +++ b/http_proxy.go @@ -704,7 +704,7 @@ func (p *Proxy) configureTeleport() func() { p.TeleportSampleRate, 1*time.Hour, true, - false, // don't include proxy identity in Teleport data to avoid tying device IDs to specific proxy IP addresses + true, ) } @@ -733,11 +733,11 @@ func (p *Proxy) configureOTELMetrics() (func(), error) { return otel.InitGlobalMeterProvider( p.buildOTELOpts( teleportHost, - true, + false, // don't include proxy name in order to reduce DataDog costs )) } -func (p *Proxy) buildOTELOpts(endpoint string, includeProxyIdentity bool) *otel.Opts { +func (p *Proxy) buildOTELOpts(endpoint string, includeProxyName bool) *otel.Opts { proxyName, provider, dc := p.ProxyName, p.Provider, p.DC if dc == "" { // This proxy is running on the old infrastructure, parse the name to get the dc @@ -776,8 +776,7 @@ func (p *Proxy) buildOTELOpts(endpoint string, includeProxyIdentity bool) *otel. } else if p.BroflakeAddr != "" { opts.Addr = p.BroflakeAddr } - if includeProxyIdentity { - opts.ExternalIP = p.ExternalIP + if includeProxyName { opts.ProxyName = proxyName } return opts diff --git a/otel/otel.go b/otel/otel.go index cd4bdc9f..cf6eeb61 100644 --- a/otel/otel.go +++ b/otel/otel.go @@ -32,7 +32,6 @@ type Opts struct { Endpoint string Headers map[string]string SampleRate int - ExternalIP string ProxyName string Track string Provider string @@ -68,16 +67,16 @@ func (opts *Opts) buildResource() *resource.Resource { if opts.Track != "" { attributes = append(attributes, attribute.String("track", opts.Track)) } - // Disable reporting proxy IP for Datadog cost reasons - // if opts.ExternalIP != "" { - // log.Debugf("Will report with proxy.ip: %v", opts.ExternalIP) - // attributes = append(attributes, attribute.String("proxy.ip", opts.ExternalIP)) - // } if opts.ProxyName != "" { - log.Debugf("Will report with proxy.name %v on provider %v in dc %v", opts.ProxyName, opts.Provider, opts.DC) - // Disable reporting proxy name for Datadog cost reasons - // attributes = append(attributes, attribute.String("proxy.name", opts.ProxyName)) + log.Debugf("Will report with proxy.name %v", opts.ProxyName) + attributes = append(attributes, attribute.String("proxy.name", opts.ProxyName)) + } + if opts.Provider != "" { + log.Debugf("Will report with provider %v", opts.Provider) attributes = append(attributes, attribute.String("provider", opts.Provider)) + } + if opts.DC != "" { + log.Debugf("Will report with dc %v", opts.DC) attributes = append(attributes, attribute.String("dc", opts.DC)) } if opts.FrontendProvider != "" {