Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions server/cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,12 @@ func main() {
var otlpExporter api.OTLPExporter
var otlpMetrics *events.OTLPMetrics
if config.OTLPEndpoint != "" {
// The relay authenticates the VM by its instance name (checked against
// active sessions), mirroring the capmonster/hcaptcha relays. Sent as
// x-api-key, not a bearer token.
headers := map[string]string{}
if config.InstanceJWT != "" {
headers["Authorization"] = "Bearer " + config.InstanceJWT
if config.InstanceName != "" {
headers["x-api-key"] = config.InstanceName
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
}
slogger.Info("OTLP export available", "endpoint", config.OTLPEndpoint, "path", config.OTLPPath)
// The OTel log SDK reports batch-queue drops through its global logger at
Expand Down
15 changes: 5 additions & 10 deletions server/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ type Config struct {
OTLPMaxQueueSize int `envconfig:"BTEL_OTLP_MAX_QUEUE_SIZE" default:"2048"`
OTLPExportInterval time.Duration `envconfig:"BTEL_OTLP_EXPORT_INTERVAL" default:"1s"`
OTLPExportTimeout time.Duration `envconfig:"BTEL_OTLP_EXPORT_TIMEOUT" default:"30s"`
// Platform-injected identity, reused to stamp the OTLP Resource. These are
// the same envs the VM already receives.
InstanceJWT string `envconfig:"KERNEL_INSTANCE_JWT" default:""`
InstanceName string `envconfig:"INST_NAME" default:""`
MetroName string `envconfig:"METRO_NAME" default:""`
// Platform-injected identity: InstanceName is sent to the relay as x-api-key
// and, with MetroName, stamps the OTLP Resource. Same envs the VM already
// receives.
InstanceName string `envconfig:"INST_NAME" default:""`
MetroName string `envconfig:"METRO_NAME" default:""`
}

// LogValue implements slog.LogValuer, redacting secret fields.
Expand All @@ -83,10 +83,6 @@ func (c *Config) LogValue() slog.Value {
if c.S2AccessToken != "" {
s2AccessToken = "[redacted]"
}
otlpJWT := ""
if c.InstanceJWT != "" {
otlpJWT = "[redacted]"
}
return slog.GroupValue(
slog.Int("port", c.Port),
slog.Int("metrics_port", c.MetricsPort),
Expand All @@ -109,7 +105,6 @@ func (c *Config) LogValue() slog.Value {
slog.String("otlp_endpoint", c.OTLPEndpoint),
slog.String("otlp_path", c.OTLPPath),
slog.Bool("otlp_insecure", c.OTLPInsecure),
slog.String("otlp_instance_jwt", otlpJWT),
Comment thread
cursor[bot] marked this conversation as resolved.
slog.String("otlp_service_name", c.OTLPServiceName),
slog.Int("otlp_max_queue_size", c.OTLPMaxQueueSize),
slog.Duration("otlp_export_interval", c.OTLPExportInterval),
Expand Down
Loading