Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
19 changes: 11 additions & 8 deletions internal/controller/reconciler/reconcile_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ var defaultRequeueMinutes = 1
var defaultRequeueDuration = time.Duration(defaultRequeueMinutes) * time.Minute

var managedWorkloadTelemetryApplications = map[string]struct{}{
"api": {},
"executor": {},
"filemeta": {},
"filestream": {},
"flat-run-fields-updater": {},
"glue": {},
"metric-observer": {},
"parquet": {},
"api": {},
"executor": {},
"filemeta": {},
"filestream": {},
"flat-run-fields-updater": {},
"glue": {},
"metric-observer": {},
"parquet": {},
"weave-trace": {},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@casey-coreweave do we still need this list, or did we move the logic into the manifest for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needed. The three managedWorkload*Applications maps here are the only place we express which apps get OTel / statsd / Datadog env injection — the Application manifest struct has no field for this, and the shipped server manifests don't carry a per-app telemetry flag. Moving this to manifest metadata is a good followup, but hasn't been done — cc @casey-coreweave who mentioned we'd like to eventually remove these lists.

"weave-trace-evaluate-model-worker": {},
"weave-trace-worker": {},
}

var managedWorkloadStatsdApplications = map[string]struct{}{
Expand Down
14 changes: 13 additions & 1 deletion internal/controller/reconciler/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"testing"

"github.com/stretchr/testify/assert"
apiv2 "github.com/wandb/operator/api/v2"
serverManifest "github.com/wandb/operator/pkg/wandb/manifest"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -1249,7 +1250,7 @@ func TestInjectManagedWorkloadTelemetryEnvvarsAddsDatadogAgentForDdtraceApps(t *
client := fake.NewClientBuilder().WithScheme(scheme).Build()
wandb := telemetryStatusWandb("wandb-dev-v2", "default", "status-otel-secret")

for _, appName := range []string{"anaconda2", "weave-trace"} {
for _, appName := range []string{"anaconda2"} {
t.Run(appName, func(t *testing.T) {
envVars, err := injectManagedWorkloadTelemetryEnvvars(
context.Background(),
Expand Down Expand Up @@ -1290,6 +1291,17 @@ func TestInjectManagedWorkloadTelemetryEnvvarsAddsDatadogAgentForDdtraceApps(t *
}
}

func TestManagedWorkloadTelemetryApplicationsContainsWeaveTraceApps(t *testing.T) {
for _, name := range []string{
"weave-trace",
"weave-trace-worker",
"weave-trace-evaluate-model-worker",
} {
_, ok := managedWorkloadTelemetryApplications[name]
assert.True(t, ok, "%q should be in the OTel allowlist", name)
}
}

func readyTelemetryResource(gvk schema.GroupVersionKind, name, namespace string) *unstructured.Unstructured {
return newTelemetryResource(gvk, name, namespace, []map[string]any{{"type": "Available", "status": "True"}})
}
Expand Down
Loading