mirror of https://github.com/coder/coder.git
chore: remove coder trace telemetry (#9677)
This commit is contained in:
parent
e7b0181519
commit
38560dd922
|
@ -105,7 +105,6 @@ func (s *scaletestTracingFlags) provider(ctx context.Context) (trace.TracerProvi
|
|||
|
||||
tracerProvider, closeTracing, err := tracing.TracerProvider(ctx, scaletestTracerName, tracing.TracerOpts{
|
||||
Default: s.traceEnable,
|
||||
Coder: s.traceCoder,
|
||||
Honeycomb: s.traceHoneycombAPIKey,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
|
@ -436,10 +435,6 @@ func LoggerFromContext(ctx context.Context) (slog.Logger, bool) {
|
|||
return l, ok
|
||||
}
|
||||
|
||||
func isTest() bool {
|
||||
return flag.Lookup("test.v") != nil
|
||||
}
|
||||
|
||||
// RootCmd contains parameters and helpers useful to all commands.
|
||||
type RootCmd struct {
|
||||
clientURL *url.URL
|
||||
|
|
|
@ -408,7 +408,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
|||
// which is caught by goleaks.
|
||||
defer http.DefaultClient.CloseIdleConnections()
|
||||
|
||||
tracerProvider, sqlDriver, closeTracing := ConfigureTraceProvider(ctx, logger, inv, vals)
|
||||
tracerProvider, sqlDriver, closeTracing := ConfigureTraceProvider(ctx, logger, vals)
|
||||
defer func() {
|
||||
logger.Debug(ctx, "closing tracing")
|
||||
traceCloseErr := shutdownWithTimeout(closeTracing, 5*time.Second)
|
||||
|
@ -2087,7 +2087,6 @@ func (s *HTTPServers) Close() {
|
|||
func ConfigureTraceProvider(
|
||||
ctx context.Context,
|
||||
logger slog.Logger,
|
||||
inv *clibase.Invocation,
|
||||
cfg *codersdk.DeploymentValues,
|
||||
) (trace.TracerProvider, string, func(context.Context) error) {
|
||||
var (
|
||||
|
@ -2095,19 +2094,10 @@ func ConfigureTraceProvider(
|
|||
closeTracing = func(context.Context) error { return nil }
|
||||
sqlDriver = "postgres"
|
||||
)
|
||||
// Coder tracing should be disabled if telemetry is disabled unless
|
||||
// --telemetry-trace was explicitly provided.
|
||||
shouldCoderTrace := cfg.Telemetry.Enable.Value() && !isTest()
|
||||
// Only override if telemetryTraceEnable was specifically set.
|
||||
// By default we want it to be controlled by telemetryEnable.
|
||||
if inv.ParsedFlags().Changed("telemetry-trace") {
|
||||
shouldCoderTrace = cfg.Telemetry.Trace.Value()
|
||||
}
|
||||
|
||||
if cfg.Trace.Enable.Value() || shouldCoderTrace || cfg.Trace.HoneycombAPIKey != "" {
|
||||
if cfg.Trace.Enable.Value() || cfg.Trace.DataDog.Value() || cfg.Trace.HoneycombAPIKey != "" {
|
||||
sdkTracerProvider, _closeTracing, err := tracing.TracerProvider(ctx, "coderd", tracing.TracerOpts{
|
||||
Default: cfg.Trace.Enable.Value(),
|
||||
Coder: shouldCoderTrace,
|
||||
DataDog: cfg.Trace.DataDog.Value(),
|
||||
Honeycomb: cfg.Trace.HoneycombAPIKey.String(),
|
||||
})
|
||||
|
|
|
@ -415,11 +415,6 @@ telemetrywhen required by your organization's security policy.
|
|||
Whether telemetry is enabled or not. Coder collects anonymized usage
|
||||
data to help improve our product.
|
||||
|
||||
[96m--[0m[96mtelemetry-trace[0m bool, [96m$CODER_TELEMETRY_TRACE[0m (default: false)
|
||||
Whether Opentelemetry traces are sent to Coder. Coder collects
|
||||
anonymized application tracing to help improve our product. Disabling
|
||||
telemetry also disables this option.
|
||||
|
||||
[93mUSER QUIET HOURS SCHEDULE OPTIONS:[0m
|
||||
Allow users to set quiet hours schedules each day for workspaces to avoid
|
||||
workspaces stopping during the day due to template max TTL.
|
||||
|
|
|
@ -334,11 +334,6 @@ telemetry:
|
|||
# help improve our product.
|
||||
# (default: false, type: bool)
|
||||
enable: false
|
||||
# Whether Opentelemetry traces are sent to Coder. Coder collects anonymized
|
||||
# application tracing to help improve our product. Disabling telemetry also
|
||||
# disables this option.
|
||||
# (default: false, type: bool)
|
||||
trace: false
|
||||
# URL to send telemetry.
|
||||
# (default: https://telemetry.coder.com, type: url)
|
||||
url: https://telemetry.coder.com
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
|
@ -26,9 +25,6 @@ type TracerOpts struct {
|
|||
// Default exports to a backend configured by environment variables. See:
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md
|
||||
Default bool
|
||||
// Coder exports traces to Coder's public tracing ingest service and is used
|
||||
// to improve the product. It is disabled when opting out of telemetry.
|
||||
Coder bool
|
||||
// DataDog exports traces and profiles to the local DataDog daemon.
|
||||
DataDog bool
|
||||
// Exports traces to Honeycomb.io with the provided API key.
|
||||
|
@ -88,14 +84,6 @@ func TracerProvider(ctx context.Context, service string, opts TracerOpts) (*sdkt
|
|||
closers = append(closers, exporter.Shutdown)
|
||||
tracerOpts = append(tracerOpts, sdktrace.WithBatcher(exporter))
|
||||
}
|
||||
if opts.Coder {
|
||||
exporter, err := CoderExporter(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("coder exporter: %w", err)
|
||||
}
|
||||
closers = append(closers, exporter.Shutdown)
|
||||
tracerOpts = append(tracerOpts, sdktrace.WithBatcher(exporter))
|
||||
}
|
||||
if opts.Honeycomb != "" {
|
||||
exporter, err := HoneycombExporter(ctx, opts.Honeycomb)
|
||||
if err != nil {
|
||||
|
@ -147,20 +135,6 @@ func DefaultExporter(ctx context.Context) (*otlptrace.Exporter, error) {
|
|||
return exporter, nil
|
||||
}
|
||||
|
||||
func CoderExporter(ctx context.Context) (*otlptrace.Exporter, error) {
|
||||
opts := []otlptracehttp.Option{
|
||||
otlptracehttp.WithEndpoint("oss-otel-ingest-http.coder.app:443"),
|
||||
otlptracehttp.WithCompression(otlptracehttp.GzipCompression),
|
||||
}
|
||||
|
||||
exporter, err := otlptrace.New(ctx, otlptracehttp.NewClient(opts...))
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("create otlp exporter: %w", err)
|
||||
}
|
||||
|
||||
return exporter, nil
|
||||
}
|
||||
|
||||
func HoneycombExporter(ctx context.Context, apiKey string) (*otlptrace.Exporter, error) {
|
||||
opts := []otlptracegrpc.Option{
|
||||
otlptracegrpc.WithEndpoint("api.honeycomb.io:443"),
|
||||
|
|
|
@ -1190,16 +1190,6 @@ when required by your organization's security policy.`,
|
|||
Group: &deploymentGroupTelemetry,
|
||||
YAML: "enable",
|
||||
},
|
||||
{
|
||||
Name: "Telemetry Trace",
|
||||
Description: "Whether Opentelemetry traces are sent to Coder. Coder collects anonymized application tracing to help improve our product. Disabling telemetry also disables this option.",
|
||||
Flag: "telemetry-trace",
|
||||
Env: "CODER_TELEMETRY_TRACE",
|
||||
Default: strconv.FormatBool(flag.Lookup("test.v") == nil),
|
||||
Value: &c.Telemetry.Trace,
|
||||
Group: &deploymentGroupTelemetry,
|
||||
YAML: "trace",
|
||||
},
|
||||
{
|
||||
Name: "Telemetry URL",
|
||||
Description: "URL to send telemetry.",
|
||||
|
|
|
@ -967,17 +967,6 @@ Minimum supported version of TLS. Accepted values are "tls10", "tls11", "tls12"
|
|||
|
||||
Whether telemetry is enabled or not. Coder collects anonymized usage data to help improve our product.
|
||||
|
||||
### --telemetry-trace
|
||||
|
||||
| | |
|
||||
| ----------- | ----------------------------------- |
|
||||
| Type | <code>bool</code> |
|
||||
| Environment | <code>$CODER_TELEMETRY_TRACE</code> |
|
||||
| YAML | <code>telemetry.trace</code> |
|
||||
| Default | <code>true</code> |
|
||||
|
||||
Whether Opentelemetry traces are sent to Coder. Coder collects anonymized application tracing to help improve our product. Disabling telemetry also disables this option.
|
||||
|
||||
### --trace
|
||||
|
||||
| | |
|
||||
|
|
|
@ -151,7 +151,7 @@ func (*RootCmd) proxyServer() *clibase.Cmd {
|
|||
defer http.DefaultClient.CloseIdleConnections()
|
||||
closers.Add(http.DefaultClient.CloseIdleConnections)
|
||||
|
||||
tracer, _, closeTracing := cli.ConfigureTraceProvider(ctx, logger, inv, cfg)
|
||||
tracer, _, closeTracing := cli.ConfigureTraceProvider(ctx, logger, cfg)
|
||||
defer func() {
|
||||
logger.Debug(ctx, "closing tracing")
|
||||
traceCloseErr := shutdownWithTimeout(closeTracing, 5*time.Second)
|
||||
|
|
|
@ -416,11 +416,6 @@ telemetrywhen required by your organization's security policy.
|
|||
Whether telemetry is enabled or not. Coder collects anonymized usage
|
||||
data to help improve our product.
|
||||
|
||||
[96m--[0m[96mtelemetry-trace[0m bool, [96m$CODER_TELEMETRY_TRACE[0m (default: false)
|
||||
Whether Opentelemetry traces are sent to Coder. Coder collects
|
||||
anonymized application tracing to help improve our product. Disabling
|
||||
telemetry also disables this option.
|
||||
|
||||
[93mUSER QUIET HOURS SCHEDULE OPTIONS:[0m
|
||||
Allow users to set quiet hours schedules each day for workspaces to avoid
|
||||
workspaces stopping during the day due to template max TTL.
|
||||
|
|
1
go.mod
1
go.mod
|
@ -165,7 +165,6 @@ require (
|
|||
go.opentelemetry.io/otel v1.17.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.17.0
|
||||
go.opentelemetry.io/otel/sdk v1.17.0
|
||||
go.opentelemetry.io/otel/trace v1.17.0
|
||||
go.uber.org/atomic v1.11.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -923,8 +923,6 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 h1:U5GYackKpVKlPrd/5gK
|
|||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0/go.mod h1:aFsJfCEnLzEu9vRRAcUiB/cpRTbVsNdF3OHSPpdjxZQ=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0 h1:iGeIsSYwpYSvh5UGzWrJfTDJvPjrXtxl3GUppj6IXQU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0/go.mod h1:1j3H3G1SBYpZFti6OI4P0uRQCW20MXkG5v4UWXppLLE=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.17.0 h1:kvWMtSUNVylLVrOE4WLUmBtgziYoCIYUNSpTYtMzVJI=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.17.0/go.mod h1:SExUrRYIXhDgEKG4tkiQovd2HTaELiHUsuK08s5Nqx4=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.40.0 h1:hf7JSONqAuXT1PDYYlVhKNMPLe4060d+4RFREcv7X2c=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 h1:Ut6hgtYcASHwCzRHkXEtSsM251cXJPW+Z9DyLwEn6iI=
|
||||
go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc=
|
||||
|
|
Loading…
Reference in New Issue