Files
conductor-oss--conductor/core/build.gradle
Shailesh Padave 396a09a4fd refactor(metrics): make Monitors self-contained; MetricsCollector becomes a registry wiring bean (#1059)
* refactor(metrics): Monitors owns its CompositeMeterRegistry; MetricsCollector wires registries in

Previously Monitors pulled its registry from MetricsCollector, creating an
awkward dependency from conductor-core → conductor-metrics. Now Monitors
owns the CompositeMeterRegistry directly and exposes addMeterRegistry() /
getRegistry(). MetricsCollector (contribs) becomes a thin Spring wiring
component that calls Monitors.addMeterRegistry() on startup.

- Removes conductor-core → conductor-metrics build dependency (cycle-free)
- Adds conductor-metrics → conductor-core build dependency
- Adds getGauge() / getDistributionSummary() aliases for callers using the
  'get' naming convention
- Deprecates MetricsCollector.getMeterRegistry() in favour of
  Monitors.getRegistry()

* Applied spotless

* test(metrics): add MonitorsTest covering registry ownership and meter APIs

Verifies addMeterRegistry(), getRegistry(), counter/timer/gauge identity
caching, getGauge/getDistributionSummary aliases, and tag isolation.

* test(metrics): add Spring integration test verifying MetricsCollector wires registries into Monitors

Boots a minimal Spring context with a SimpleMeterRegistry, confirms that
counters/timers/gauges recorded via Monitors are visible in the
Spring-wired registry after MetricsCollector initialises.

* Applied spotless

* refactor(metrics): retire conductor-metrics module, move classes to core/server

MetricsCollector moves to core alongside Monitors — they are companion classes
(Monitors owns the registry, MetricsCollector wires Spring-managed registries in).
Registry-specific configs (Logging, CloudWatch, AzureMonitor) move to server where
they belong as deployment-level concerns. No Java code imported from the old
contribs.metrics package, so this is a pure relocation with no call-site changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(metrics): delete retired conductor-metrics module directory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(metrics): add micrometer-registry-prometheus to server and server-lite

Without this dependency Spring Boot cannot create PrometheusMeterRegistry,
so /actuator/prometheus silently returns 404 even though
conductor.metrics-prometheus.enabled=true is set in all default configs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: simplify metrics comment in server build files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(build): remove stale :conductor-metrics dep from scheduler-core

The scheduler module (merged from main via #1064) still referenced
:conductor-metrics, which this branch retired. Monitors is already
provided by :conductor-core.

---------
2026-05-21 11:03:21 -07:00

95 lines
4.4 KiB
Groovy

/*
* Copyright 2023 Conductor authors
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
apply plugin: 'groovy'
dependencies {
implementation project(':conductor-common')
compileOnly 'org.springframework.boot:spring-boot-starter'
compileOnly 'org.springframework.boot:spring-boot-starter-validation'
compileOnly 'org.springframework.retry:spring-retry'
implementation "com.fasterxml.jackson.core:jackson-annotations:${revFasterXml}"
implementation "com.fasterxml.jackson.core:jackson-databind:${revFasterXml}"
implementation "commons-io:commons-io:${revCommonsIo}"
implementation "com.google.protobuf:protobuf-java:${revProtoBuf}"
implementation "org.apache.commons:commons-lang3"
implementation "com.fasterxml.jackson.core:jackson-core:${revFasterXml}"
implementation "com.spotify:completable-futures:${revSpotifyCompletableFutures}"
implementation "com.jayway.jsonpath:json-path:${revJsonPath}"
implementation "io.reactivex:rxjava:${revRxJava}"
implementation "org.apache.bval:bval-jsr:${revBval}"
implementation "com.github.ben-manes.caffeine:caffeine"
// Nashorn is deprecated and removed in Java 15+, replaced by GraalJS
// implementation "org.openjdk.nashorn:nashorn-core:15.4"
implementation "io.micrometer:micrometer-core:${revMicrometer}"
implementation "com.google.guava:guava:${revGuava}"
//GraalVM dependencies for executing JavaScript and Python
// PINNED (#964): all GraalVM artifacts must use the same version (revGraalVM in dependencies.gradle)
implementation("org.graalvm.polyglot:polyglot:${revGraalVM}")
implementation("org.graalvm.js:js:${revGraalVM}")
implementation("org.graalvm.js:js-scriptengine:${revGraalVM}")
implementation("org.graalvm.polyglot:python:${revGraalVM}")
implementation "org.graalvm.sdk:graal-sdk:${revGraalVM}"
// Optimizing Truffle runtime (UPL 1.0). Without it GraalJS runs in the Truffle
// interpreter, which is 10-100x slower than the JIT-compiled path.
implementation("org.graalvm.truffle:truffle-runtime:${revGraalVM}")
// JAXB is not bundled with Java 11, dependencies added explicitly
// These are needed by Apache BVAL
implementation "jakarta.xml.bind:jakarta.xml.bind-api:${revJAXB}"
implementation "jakarta.activation:jakarta.activation-api:${revActivation}"
// Only add it as a test dependency. The actual jaxb runtime provider is provided when building the server.
testImplementation "org.glassfish.jaxb:jaxb-runtime:${revJAXB}"
testImplementation 'org.springframework.boot:spring-boot-starter-validation'
testImplementation 'org.springframework.retry:spring-retry'
testImplementation project(':conductor-common').sourceSets.test.output
testImplementation "org.apache.groovy:groovy-all:${revGroovy}"
testImplementation "org.spockframework:spock-core:${revSpock}"
testImplementation "org.spockframework:spock-spring:${revSpock}"
testImplementation "org.junit.vintage:junit-vintage-engine"
// Benchmark-only deps (test scope so they don't ship with production):
// Rhino — MPL 2.0, JVM-bytecode-compiled JS engine
testImplementation "org.mozilla:rhino:1.8.0"
// Javet — Apache 2.0 JNI bindings to V8 (BSD-3-Clause). Native lib for this host's
// arch only; add other -macos-x86_64 / -linux-x86_64 / -linux-arm64 variants for prod.
testImplementation "com.caoccao.javet:javet:4.1.2"
testImplementation "com.caoccao.javet:javet-v8-macos-arm64:4.1.2"
}
// Standalone benchmark runner for comparing JS engines on representative Inline-task scripts.
// Run with: ./gradlew :conductor-core:benchmarkScripts
task benchmarkScripts(type: JavaExec) {
group = "verification"
description = "Run JS engine benchmark (GraalJS interpreter vs Rhino vs Javet/V8)"
classpath = sourceSets.test.runtimeClasspath
mainClass = "com.netflix.conductor.benchmark.ScriptEngineBenchmark"
jvmArgs = ["-Xmx2g"]
}