Skip to content
Merged
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: 19 additions & 0 deletions cmd/wfctl/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ func TestRunInitAPIServiceTemplate(t *testing.T) {
if !strings.Contains(string(yml), "my-service-server") {
t.Errorf("workflow.yaml missing expected module name, got: %s", string(yml))
}
if !strings.Contains(string(yml), "type: observability.telemetry") {
t.Errorf("workflow.yaml missing observability.telemetry, got: %s", string(yml))
}
if !strings.Contains(string(yml), "type: observability.collector") {
t.Errorf("workflow.yaml missing observability.collector, got: %s", string(yml))
}
if strings.Contains(string(yml), "type: metrics.collector") {
t.Errorf("workflow.yaml should not create metrics.collector, got: %s", string(yml))
}
}

func TestRunInitEventProcessorTemplate(t *testing.T) {
Expand Down Expand Up @@ -96,6 +105,16 @@ func TestRunInitFullStackTemplate(t *testing.T) {
t.Errorf("expected %s to be created", f)
}
}
yml, err := os.ReadFile(filepath.Join(outDir, "workflow.yaml"))
if err != nil {
t.Fatalf("failed to read workflow.yaml: %v", err)
}
if !strings.Contains(string(yml), "type: observability.telemetry") {
t.Errorf("workflow.yaml missing observability.telemetry, got: %s", string(yml))
}
if strings.Contains(string(yml), "type: metrics.collector") {
t.Errorf("workflow.yaml should not create metrics.collector, got: %s", string(yml))
}
}

func TestRunInitPluginTemplate(t *testing.T) {
Expand Down
14 changes: 11 additions & 3 deletions cmd/wfctl/templates/api-service/workflow.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ modules:
config:
description: "Health check endpoint for {{.Name}}"

- name: {{.Name}}-metrics
type: metrics.collector
- name: {{.Name}}-telemetry
type: observability.telemetry
config:
description: "Prometheus metrics for {{.Name}}"
serviceName: "{{.Name}}"
environment: "local"

- name: {{.Name}}-collector
type: observability.collector
config:
distribution: external
topology: external
signals: [traces, metrics, logs]

workflows:
http:
Expand Down
14 changes: 11 additions & 3 deletions cmd/wfctl/templates/full-stack/workflow.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ modules:
config:
description: "Health check endpoint"

- name: {{.Name}}-metrics
type: metrics.collector
- name: {{.Name}}-telemetry
type: observability.telemetry
config:
description: "Prometheus metrics"
serviceName: "{{.Name}}"
environment: "local"

- name: {{.Name}}-collector
type: observability.collector
config:
distribution: external
topology: external
signals: [traces, metrics, logs]

workflows:
http:
Expand Down
12 changes: 12 additions & 0 deletions cmd/wfctl/type_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ func KnownModuleTypes() map[string]ModuleTypeInfo {
Stateful: false,
ConfigKeys: []string{"namespace", "subsystem", "metricsPath", "enabledMetrics"},
},
"observability.telemetry": {
Type: "observability.telemetry",
Plugin: "observability",
Stateful: false,
ConfigKeys: []string{"serviceName", "environment", "resource", "metricsInterval", "otlpEndpoint"},
},
"observability.collector": {
Type: "observability.collector",
Plugin: "observability",
Stateful: false,
ConfigKeys: []string{"distribution", "topology", "signals", "receivers", "processors", "exporters", "routes"},
},
"health.checker": {
Type: "health.checker",
Plugin: "observability",
Expand Down
2 changes: 2 additions & 0 deletions cmd/wfctl/type_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func TestKnownModuleTypesPopulated(t *testing.T) {
"messaging.broker",
"statemachine.engine",
"metrics.collector",
"observability.telemetry",
"observability.collector",
"health.checker",
"cache.redis",
}
Expand Down
Loading