Skip to content

Commit

Permalink
Send proxy_name to teleport
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Oct 19, 2023
1 parent bb2cbec commit 1a64060
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
9 changes: 4 additions & 5 deletions http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions otel/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type Opts struct {
Endpoint string
Headers map[string]string
SampleRate int
ExternalIP string
ProxyName string
Track string
Provider string
Expand Down Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 1a64060

Please sign in to comment.