Skip to content

Commit 38560dd

Browse files
authored
chore: remove coder trace telemetry (#9677)
1 parent e7b0181 commit 38560dd

File tree

12 files changed

+3
-84
lines changed

12 files changed

+3
-84
lines changed

cli/exp_scaletest.go

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ func (s *scaletestTracingFlags) provider(ctx context.Context) (trace.TracerProvi
105105

106106
tracerProvider, closeTracing, err := tracing.TracerProvider(ctx, scaletestTracerName, tracing.TracerOpts{
107107
Default: s.traceEnable,
108-
Coder: s.traceCoder,
109108
Honeycomb: s.traceHoneycombAPIKey,
110109
})
111110
if err != nil {

cli/root.go

-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"encoding/base64"
88
"encoding/json"
99
"errors"
10-
"flag"
1110
"fmt"
1211
"io"
1312
"math/rand"
@@ -436,10 +435,6 @@ func LoggerFromContext(ctx context.Context) (slog.Logger, bool) {
436435
return l, ok
437436
}
438437

439-
func isTest() bool {
440-
return flag.Lookup("test.v") != nil
441-
}
442-
443438
// RootCmd contains parameters and helpers useful to all commands.
444439
type RootCmd struct {
445440
clientURL *url.URL

cli/server.go

+2-12
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
408408
// which is caught by goleaks.
409409
defer http.DefaultClient.CloseIdleConnections()
410410

411-
tracerProvider, sqlDriver, closeTracing := ConfigureTraceProvider(ctx, logger, inv, vals)
411+
tracerProvider, sqlDriver, closeTracing := ConfigureTraceProvider(ctx, logger, vals)
412412
defer func() {
413413
logger.Debug(ctx, "closing tracing")
414414
traceCloseErr := shutdownWithTimeout(closeTracing, 5*time.Second)
@@ -2087,27 +2087,17 @@ func (s *HTTPServers) Close() {
20872087
func ConfigureTraceProvider(
20882088
ctx context.Context,
20892089
logger slog.Logger,
2090-
inv *clibase.Invocation,
20912090
cfg *codersdk.DeploymentValues,
20922091
) (trace.TracerProvider, string, func(context.Context) error) {
20932092
var (
20942093
tracerProvider = trace.NewNoopTracerProvider()
20952094
closeTracing = func(context.Context) error { return nil }
20962095
sqlDriver = "postgres"
20972096
)
2098-
// Coder tracing should be disabled if telemetry is disabled unless
2099-
// --telemetry-trace was explicitly provided.
2100-
shouldCoderTrace := cfg.Telemetry.Enable.Value() && !isTest()
2101-
// Only override if telemetryTraceEnable was specifically set.
2102-
// By default we want it to be controlled by telemetryEnable.
2103-
if inv.ParsedFlags().Changed("telemetry-trace") {
2104-
shouldCoderTrace = cfg.Telemetry.Trace.Value()
2105-
}
21062097

2107-
if cfg.Trace.Enable.Value() || shouldCoderTrace || cfg.Trace.HoneycombAPIKey != "" {
2098+
if cfg.Trace.Enable.Value() || cfg.Trace.DataDog.Value() || cfg.Trace.HoneycombAPIKey != "" {
21082099
sdkTracerProvider, _closeTracing, err := tracing.TracerProvider(ctx, "coderd", tracing.TracerOpts{
21092100
Default: cfg.Trace.Enable.Value(),
2110-
Coder: shouldCoderTrace,
21112101
DataDog: cfg.Trace.DataDog.Value(),
21122102
Honeycomb: cfg.Trace.HoneycombAPIKey.String(),
21132103
})

cli/testdata/coder_server_--help.golden

-5
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,6 @@ telemetrywhen required by your organization's security policy.
415415
Whether telemetry is enabled or not. Coder collects anonymized usage
416416
data to help improve our product.
417417

418-
--telemetry-trace bool, $CODER_TELEMETRY_TRACE (default: false)
419-
Whether Opentelemetry traces are sent to Coder. Coder collects
420-
anonymized application tracing to help improve our product. Disabling
421-
telemetry also disables this option.
422-
423418
USER QUIET HOURS SCHEDULE OPTIONS:
424419
Allow users to set quiet hours schedules each day for workspaces to avoid
425420
workspaces stopping during the day due to template max TTL.

cli/testdata/server-config.yaml.golden

-5
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,6 @@ telemetry:
334334
# help improve our product.
335335
# (default: false, type: bool)
336336
enable: false
337-
# Whether Opentelemetry traces are sent to Coder. Coder collects anonymized
338-
# application tracing to help improve our product. Disabling telemetry also
339-
# disables this option.
340-
# (default: false, type: bool)
341-
trace: false
342337
# URL to send telemetry.
343338
# (default: https://telemetry.coder.com, type: url)
344339
url: https://telemetry.coder.com

coderd/tracing/exporter.go

-26
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"go.opentelemetry.io/otel"
99
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
1010
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
11-
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
1211
"go.opentelemetry.io/otel/propagation"
1312
"go.opentelemetry.io/otel/sdk/resource"
1413
sdktrace "go.opentelemetry.io/otel/sdk/trace"
@@ -26,9 +25,6 @@ type TracerOpts struct {
2625
// Default exports to a backend configured by environment variables. See:
2726
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md
2827
Default bool
29-
// Coder exports traces to Coder's public tracing ingest service and is used
30-
// to improve the product. It is disabled when opting out of telemetry.
31-
Coder bool
3228
// DataDog exports traces and profiles to the local DataDog daemon.
3329
DataDog bool
3430
// Exports traces to Honeycomb.io with the provided API key.
@@ -88,14 +84,6 @@ func TracerProvider(ctx context.Context, service string, opts TracerOpts) (*sdkt
8884
closers = append(closers, exporter.Shutdown)
8985
tracerOpts = append(tracerOpts, sdktrace.WithBatcher(exporter))
9086
}
91-
if opts.Coder {
92-
exporter, err := CoderExporter(ctx)
93-
if err != nil {
94-
return nil, nil, xerrors.Errorf("coder exporter: %w", err)
95-
}
96-
closers = append(closers, exporter.Shutdown)
97-
tracerOpts = append(tracerOpts, sdktrace.WithBatcher(exporter))
98-
}
9987
if opts.Honeycomb != "" {
10088
exporter, err := HoneycombExporter(ctx, opts.Honeycomb)
10189
if err != nil {
@@ -147,20 +135,6 @@ func DefaultExporter(ctx context.Context) (*otlptrace.Exporter, error) {
147135
return exporter, nil
148136
}
149137

150-
func CoderExporter(ctx context.Context) (*otlptrace.Exporter, error) {
151-
opts := []otlptracehttp.Option{
152-
otlptracehttp.WithEndpoint("oss-otel-ingest-http.coder.app:443"),
153-
otlptracehttp.WithCompression(otlptracehttp.GzipCompression),
154-
}
155-
156-
exporter, err := otlptrace.New(ctx, otlptracehttp.NewClient(opts...))
157-
if err != nil {
158-
return nil, xerrors.Errorf("create otlp exporter: %w", err)
159-
}
160-
161-
return exporter, nil
162-
}
163-
164138
func HoneycombExporter(ctx context.Context, apiKey string) (*otlptrace.Exporter, error) {
165139
opts := []otlptracegrpc.Option{
166140
otlptracegrpc.WithEndpoint("api.honeycomb.io:443"),

codersdk/deployment.go

-10
Original file line numberDiff line numberDiff line change
@@ -1190,16 +1190,6 @@ when required by your organization's security policy.`,
11901190
Group: &deploymentGroupTelemetry,
11911191
YAML: "enable",
11921192
},
1193-
{
1194-
Name: "Telemetry Trace",
1195-
Description: "Whether Opentelemetry traces are sent to Coder. Coder collects anonymized application tracing to help improve our product. Disabling telemetry also disables this option.",
1196-
Flag: "telemetry-trace",
1197-
Env: "CODER_TELEMETRY_TRACE",
1198-
Default: strconv.FormatBool(flag.Lookup("test.v") == nil),
1199-
Value: &c.Telemetry.Trace,
1200-
Group: &deploymentGroupTelemetry,
1201-
YAML: "trace",
1202-
},
12031193
{
12041194
Name: "Telemetry URL",
12051195
Description: "URL to send telemetry.",

docs/cli/server.md

-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enterprise/cli/proxyserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (*RootCmd) proxyServer() *clibase.Cmd {
151151
defer http.DefaultClient.CloseIdleConnections()
152152
closers.Add(http.DefaultClient.CloseIdleConnections)
153153

154-
tracer, _, closeTracing := cli.ConfigureTraceProvider(ctx, logger, inv, cfg)
154+
tracer, _, closeTracing := cli.ConfigureTraceProvider(ctx, logger, cfg)
155155
defer func() {
156156
logger.Debug(ctx, "closing tracing")
157157
traceCloseErr := shutdownWithTimeout(closeTracing, 5*time.Second)

enterprise/cli/testdata/coder_server_--help.golden

-5
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,6 @@ telemetrywhen required by your organization's security policy.
416416
Whether telemetry is enabled or not. Coder collects anonymized usage
417417
data to help improve our product.
418418

419-
--telemetry-trace bool, $CODER_TELEMETRY_TRACE (default: false)
420-
Whether Opentelemetry traces are sent to Coder. Coder collects
421-
anonymized application tracing to help improve our product. Disabling
422-
telemetry also disables this option.
423-
424419
USER QUIET HOURS SCHEDULE OPTIONS:
425420
Allow users to set quiet hours schedules each day for workspaces to avoid
426421
workspaces stopping during the day due to template max TTL.

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ require (
165165
go.opentelemetry.io/otel v1.17.0
166166
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0
167167
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0
168-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.17.0
169168
go.opentelemetry.io/otel/sdk v1.17.0
170169
go.opentelemetry.io/otel/trace v1.17.0
171170
go.uber.org/atomic v1.11.0

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,6 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 h1:U5GYackKpVKlPrd/5gK
923923
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0/go.mod h1:aFsJfCEnLzEu9vRRAcUiB/cpRTbVsNdF3OHSPpdjxZQ=
924924
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0 h1:iGeIsSYwpYSvh5UGzWrJfTDJvPjrXtxl3GUppj6IXQU=
925925
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0/go.mod h1:1j3H3G1SBYpZFti6OI4P0uRQCW20MXkG5v4UWXppLLE=
926-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.17.0 h1:kvWMtSUNVylLVrOE4WLUmBtgziYoCIYUNSpTYtMzVJI=
927-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.17.0/go.mod h1:SExUrRYIXhDgEKG4tkiQovd2HTaELiHUsuK08s5Nqx4=
928926
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.40.0 h1:hf7JSONqAuXT1PDYYlVhKNMPLe4060d+4RFREcv7X2c=
929927
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 h1:Ut6hgtYcASHwCzRHkXEtSsM251cXJPW+Z9DyLwEn6iI=
930928
go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc=

0 commit comments

Comments
 (0)