Skip to content

Commit 3d46f1f

Browse files
revision based on pr feedback, critical requirement oversight was that legacy metrics was never released and thus does not need continued support, it can be replaced wholesale.
1 parent b8b4104 commit 3d46f1f

22 files changed

Lines changed: 423 additions & 2015 deletions

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ All notable changes to this project will be documented in this file.
66

77
### Added
88

9-
- Canonical metrics mode: opt-in harmonized metric surface via `WORKER_CANONICAL_METRICS=true`[details](conductor-client-metrics/README.md#detailed-technical-notes--unreleased)
10-
- Automatic metrics wiring: `ConductorClient.Builder.withMetricsCollector(...)` installs the HTTP interceptor and auto-registers listeners on `TaskClient` and `WorkflowClient` (automatic in canonical mode; opt-in via `setAutoWiringEnabled(true)` for legacy)
9+
- Standardized Prometheus metrics: `PrometheusMetricsCollector` now emits the harmonized cross-SDK metric surface — [details](conductor-client-metrics/README.md)
10+
- Automatic metrics wiring: `ConductorClient.Builder.withMetricsCollector(...)` installs the HTTP interceptor and auto-registers listeners on `TaskClient`, `WorkflowClient`, and `TaskRunnerConfigurer`
11+
- HTTP API client metrics via OkHttp interceptor (`http_api_client_request_seconds`, `task_result_size_bytes`, `workflow_input_size_bytes`)
12+
- Event-driven metrics architecture with `EventDispatcher` and typed event POJOs
1113

1214
### Changed
1315

14-
- Legacy metrics emit unchanged by default; no env var required
16+
- `PrometheusMetricsCollector` metric names updated to the harmonized cross-SDK catalog (e.g. `task_poll_total`, `task_execute_time_seconds`)
1517
- `micrometer-registry-prometheus` is now a transitive (`api`) dependency
1618

1719
### Deprecated
1820

19-
- `PrometheusMetricsCollector` — use `MetricsCollectorFactory.create()` or `MetricsBundle.create()`
2021
- `TaskClient.ack(String, String)` — use `ack(String taskType, String taskId, String workerId)`
2122

2223
## [4.0.0] - 2024-10-09

INTERCEPTOR.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -240,31 +240,19 @@ public class ListenerRegister {
240240
}
241241
```
242242

243-
### 4. MetricsCollectorFactory / LegacyPrometheusMetricsCollector / CanonicalPrometheusMetricsCollector
243+
### 4. PrometheusMetricsCollector
244244

245245
**Location**: `conductor-client-metrics/src/main/java/com/netflix/conductor/client/metrics/prometheus/`
246246

247247
Reference implementation of `MetricsCollector` using Micrometer Prometheus.
248248

249249
**Features**:
250250
- Exposes HTTP endpoint for Prometheus scraping (default: `localhost:9991/metrics`)
251-
- Selects either the legacy or canonical Prometheus collector at startup
252251
- Records worker, task client, and workflow client metrics through the event listener system
253252
- Records HTTP API client metrics through an OkHttp interceptor
254253
- Keeps the metrics backend separated from task and workflow business logic
255254

256-
For setup instructions, environment-variable selection, the complete legacy and canonical metric catalogs, and migration guidance, see [`conductor-client-metrics/README.md`](conductor-client-metrics/README.md).
257-
258-
### Compatibility: `PrometheusMetricsCollector`
259-
260-
`com.netflix.conductor.client.metrics.prometheus.PrometheusMetricsCollector` is retained as a deprecated alias for `LegacyPrometheusMetricsCollector`. Existing 4.0.x code that does:
261-
262-
```java
263-
PrometheusMetricsCollector metricsCollector = new PrometheusMetricsCollector();
264-
metricsCollector.startServer(9991, "/metrics");
265-
```
266-
267-
continues to compile and emit the same six legacy meter names (`poll_started`, `poll_success`, `poll_failure`, `task_execution_started`, `task_execution_completed`, `task_execution_failure`) byte-for-byte. The shim deliberately delegates to `LegacyPrometheusMetricsCollector`, **not** to `MetricsCollectorFactory.create()`, so an upgrader who already has `WORKER_CANONICAL_METRICS=true` in their environment is not silently flipped to the canonical surface. New code should use `MetricsCollectorFactory.create()` (or `MetricsBundle.create()`) to opt into env-var-driven selection.
255+
For the complete metric catalog and setup instructions, see [`conductor-client-metrics/README.md`](conductor-client-metrics/README.md).
268256

269257
## Event Lifecycle
270258

@@ -352,16 +340,17 @@ import com.netflix.conductor.client.automator.TaskRunnerConfigurer;
352340
import com.netflix.conductor.client.http.ConductorClient;
353341
import com.netflix.conductor.client.http.TaskClient;
354342
import com.netflix.conductor.client.http.WorkflowClient;
355-
import com.netflix.conductor.client.metrics.prometheus.MetricsBundle;
343+
import com.netflix.conductor.client.metrics.prometheus.PrometheusMetricsCollector;
356344

357-
// 1. Create and start metrics (factory-selected collector + Prometheus scrape server)
358-
MetricsBundle bundle = MetricsBundle.create(); // port 9991, /metrics
345+
// 1. Create and start metrics
346+
PrometheusMetricsCollector metricsCollector = new PrometheusMetricsCollector();
347+
metricsCollector.startServer(); // port 9991, /metrics
359348

360349
// 2. Create ConductorClient — withMetricsCollector installs the HTTP interceptor
361350
// and enables automatic listener registration on downstream clients
362351
ConductorClient client = ConductorClient.builder()
363352
.basePath("http://conductor-server:8080/api")
364-
.withMetricsCollector(bundle.getCollector())
353+
.withMetricsCollector(metricsCollector)
365354
.build();
366355

367356
// 3. Downstream clients auto-register as listeners
@@ -376,13 +365,13 @@ TaskRunnerConfigurer configurer = new TaskRunnerConfigurer.Builder(taskClient, w
376365
configurer.init();
377366
```
378367

379-
For fine-grained control over which listeners are registered, use `withHttpMetrics` instead of `withMetricsCollector`. This installs only the HTTP interceptor and leaves all listener registration to you. See the [Manual Wiring](conductor-client-metrics/README.md#manual-wiring) section in the metrics README.
368+
For fine-grained control over which listeners are registered, create the `ConductorClient` without `withMetricsCollector` and register listeners explicitly. See the [Manual Wiring](conductor-client-metrics/README.md#manual-wiring) section in the metrics README.
380369

381370
### Custom Metrics Endpoint
382371

383372
```java
384373
// Start Prometheus server on custom port and endpoint
385-
AbstractPrometheusMetricsCollector metricsCollector = MetricsCollectorFactory.create();
374+
PrometheusMetricsCollector metricsCollector = new PrometheusMetricsCollector();
386375
metricsCollector.startServer(8080, "/custom-metrics");
387376
```
388377

@@ -858,7 +847,7 @@ public class CloudWatchMetricsCollector implements MetricsCollector {
858847

859848
```java
860849
// Create multiple collectors
861-
AbstractPrometheusMetricsCollector prometheus = MetricsCollectorFactory.create();
850+
PrometheusMetricsCollector prometheus = new PrometheusMetricsCollector();
862851
prometheus.startServer(9991, "/metrics");
863852

864853
DatadogMetricsCollector datadog = new DatadogMetricsCollector(
@@ -1219,8 +1208,7 @@ import com.netflix.conductor.client.http.TaskClient;
12191208
import com.netflix.conductor.client.http.ConductorClient;
12201209
import com.netflix.conductor.client.automator.TaskRunnerConfigurer;
12211210
import com.netflix.conductor.client.worker.Worker;
1222-
import com.netflix.conductor.client.metrics.prometheus.MetricsCollectorFactory;
1223-
import com.netflix.conductor.client.metrics.prometheus.AbstractPrometheusMetricsCollector;
1211+
import com.netflix.conductor.client.metrics.prometheus.PrometheusMetricsCollector;
12241212
import java.util.List;
12251213

12261214
public class ConductorMonitoringSetup {
@@ -1239,7 +1227,7 @@ public class ConductorMonitoringSetup {
12391227
);
12401228

12411229
// 3. Setup Prometheus metrics
1242-
AbstractPrometheusMetricsCollector prometheus = MetricsCollectorFactory.create();
1230+
PrometheusMetricsCollector prometheus = new PrometheusMetricsCollector();
12431231
prometheus.startServer(9991, "/metrics");
12441232

12451233
// 4. Setup custom monitoring

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,24 +303,32 @@ Enable Prometheus metrics collection for monitoring workers:
303303
```groovy
304304
// Using conductor-client-metrics module
305305
dependencies {
306-
implementation 'org.conductoross:conductor-client-metrics:4.0.1'
306+
implementation 'org.conductoross:conductor-client-metrics:5.1.0'
307307
}
308308
```
309309
310310
```java
311-
import com.netflix.conductor.client.metrics.prometheus.MetricsCollectorFactory;
311+
import com.netflix.conductor.client.metrics.prometheus.PrometheusMetricsCollector;
312+
313+
PrometheusMetricsCollector metricsCollector = new PrometheusMetricsCollector();
314+
metricsCollector.startServer(); // http://localhost:9991/metrics
315+
316+
ConductorClient client = ConductorClient.builder()
317+
.basePath("...")
318+
.withMetricsCollector(metricsCollector)
319+
.build();
320+
321+
TaskClient taskClient = new TaskClient(client);
322+
WorkflowClient workflowClient = new WorkflowClient(client);
312323
313324
TaskRunnerConfigurer configurer = new TaskRunnerConfigurer.Builder(taskClient, workers)
314325
.withThreadCount(10)
315-
.withMetricsCollector(MetricsCollectorFactory.create())
316326
.build();
317327
```
318328
319-
`MetricsCollectorFactory.create()` uses the legacy Java SDK metric names by default. Set `WORKER_CANONICAL_METRICS=true` to opt in to the canonical cross-SDK metric names.
320-
321-
> Migrating from 4.0.x? `PrometheusMetricsCollector` still works — it is now a deprecated alias for `LegacyPrometheusMetricsCollector` and emits the same six legacy meter names byte-for-byte. New code should use `MetricsCollectorFactory.create()` (or `MetricsBundle.create()`) so it can opt into canonical metrics via `WORKER_CANONICAL_METRICS=true`.
329+
When a `MetricsCollector` is attached to the `ConductorClient`, downstream clients (`TaskClient`, `WorkflowClient`, `TaskRunnerConfigurer`) automatically register themselves as event listeners.
322330
323-
See [conductor-client-metrics/README.md](conductor-client-metrics/README.md) for setup details, the complete legacy and canonical metric catalogs, and migration guidance.
331+
See [conductor-client-metrics/README.md](conductor-client-metrics/README.md) for the complete metric catalog and setup details.
324332
325333
## Workflows
326334

0 commit comments

Comments
 (0)