Skip to content

Commit

Permalink
[WOR-1560] Upgrade to TCL 1.0.10 for MDC-aware Stairway (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
okotsopoulos authored Mar 22, 2024
1 parent ed97912 commit d345b2b
Show file tree
Hide file tree
Showing 16 changed files with 127 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,18 @@ dependencies {
compileOnly "com.google.code.findbugs:annotations:3.0.1"
implementation 'org.slf4j:slf4j-api'
implementation 'io.swagger.core.v3:swagger-annotations:2.1.12'
implementation 'io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:2.2.0'
// Needed for @VisibleForTesting and more:
// TCL 1.0.10 tries to expose this as an api dependency, but does so without specifying an explicit version
// (it derives the version from com.google.cloud:libraries-bom, which it doesn't expose to consumers).
// If TCL instead exposed the BOM, or exposed guava with a specified version, this could be removed.
implementation 'com.google.guava:guava:33.1.0-jre'
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.47'

testImplementation 'ch.qos.logback:logback-classic'
testImplementation 'org.hamcrest:hamcrest:2.2'

var openTelemetryVersion = '1.32.0'
implementation "io.opentelemetry:opentelemetry-api:${openTelemetryVersion}"
implementation "io.opentelemetry:opentelemetry-sdk:${openTelemetryVersion}"
implementation "io.opentelemetry:opentelemetry-sdk-metrics:${openTelemetryVersion}"
implementation "io.opentelemetry:opentelemetry-exporter-logging:${openTelemetryVersion}"
implementation "io.opentelemetry.semconv:opentelemetry-semconv:1.21.0-alpha"
implementation "io.opentelemetry.instrumentation:opentelemetry-spring-webmvc-6.0:${openTelemetryVersion}-alpha"
implementation "io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:${openTelemetryVersion}"
implementation "io.opentelemetry.instrumentation:opentelemetry-spring-boot:${openTelemetryVersion}-alpha"
implementation "com.google.cloud.opentelemetry:exporter-trace:0.25.2"

implementation ('bio.terra:terra-common-lib:0.1.6-SNAPSHOT'){
implementation ('bio.terra:terra-common-lib:1.0.10-SNAPSHOT') {
exclude group: "org.broadinstitute.dsde.workbench", module: "sam-client_2.13"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
plugins {
id 'bio.terra.landingzone.java-common-conventions'
id 'io.spring.dependency-management'
id 'org.springframework.boot'
id 'bio.terra.landingzone.java-spring-conventions'
id 'application'
}

// Spring Boot 3.1.2 pulls in postgresql 42.6.0, vulnerable to CVE-2024-1597
ext['postgresql.version'] = '42.7.2'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id 'bio.terra.landingzone.java-common-conventions'
id 'io.spring.dependency-management'
id 'org.springframework.boot'
}

// Spring Boot 3.1.2 pulls in postgresql 42.6.0, vulnerable to CVE-2024-1597
ext['postgresql.version'] = '42.7.2'
// Spring Boot 3.1.2 pulls in opentelemetry-bom 1.25.0.
// It must have version >= 1.34.1 for compatibility with terra-common-lib 1.0.9:
ext['opentelemetry.version'] = '1.36.0'
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
plugins {
id 'bio.terra.landingzone.java-common-conventions'
id 'io.spring.dependency-management'
id 'org.springframework.boot'
id 'bio.terra.landingzone.java-spring-conventions'
id 'java-library'
id 'maven-publish'
}
3 changes: 1 addition & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ plugins {
apply from: 'publishing.gradle'

dependencies {
implementation 'bio.terra:terra-common-lib'
implementation 'org.apache.commons:commons-dbcp2'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand Down Expand Up @@ -57,7 +56,7 @@ dependencies {

testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'org.awaitility:awaitility:4.2.0'
testImplementation('org.springframework.boot:spring-boot-starter-test:3.1.2') {
testImplementation('org.springframework.boot:spring-boot-starter-test') {
// Fixes warning about multiple occurrences of JSONObject on the classpath
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import bio.terra.landingzone.job.exception.InvalidJobParameterException;
import bio.terra.landingzone.job.model.OperationType;
import bio.terra.landingzone.service.landingzone.azure.model.LandingZoneRequest;
import bio.terra.landingzone.stairway.common.utils.LandingZoneMdcHook;
import bio.terra.landingzone.stairway.flight.LandingZoneFlightMapKeys;
import bio.terra.stairway.Flight;
import bio.terra.stairway.FlightMap;
Expand All @@ -20,7 +19,6 @@
public class LandingZoneJobBuilder {
private final LandingZoneJobService jobService;
private final StairwayComponent stairwayComponent;
private final LandingZoneMdcHook mdcHook;
private final FlightMap jobParameterMap;
private final OpenTelemetry openTelemetry;
private Class<? extends Flight> flightClass;
Expand All @@ -33,11 +31,9 @@ public class LandingZoneJobBuilder {
public LandingZoneJobBuilder(
LandingZoneJobService jobService,
StairwayComponent stairwayComponent,
LandingZoneMdcHook mdcHook,
OpenTelemetry openTelemetry) {
this.jobService = jobService;
this.stairwayComponent = stairwayComponent;
this.mdcHook = mdcHook;
this.openTelemetry = openTelemetry;
this.jobParameterMap = new FlightMap();
}
Expand Down Expand Up @@ -126,8 +122,7 @@ private void populateInputParams() {
jobId = stairwayComponent.get().createFlightId();
}

// Always add the MDC logging and tracing span parameters for the mdc hook
addParameter(LandingZoneMdcHook.MDC_FLIGHT_MAP_KEY, mdcHook.getSerializedCurrentContext());
// Always add the tracing span parameters
addParameter(
MonitoringHook.SUBMISSION_SPAN_CONTEXT_MAP_KEY,
MonitoringHook.serializeCurrentTracingContext(openTelemetry));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import bio.terra.landingzone.service.iam.SamRethrow;
import bio.terra.landingzone.service.landingzone.azure.model.DeletedLandingZone;
import bio.terra.landingzone.service.landingzone.azure.model.LandingZoneRequest;
import bio.terra.landingzone.stairway.common.utils.LandingZoneMdcHook;
import bio.terra.landingzone.stairway.common.utils.StairwayLoggingHook;
import bio.terra.landingzone.stairway.flight.LandingZoneFlightMapKeys;
import bio.terra.stairway.Flight;
import bio.terra.stairway.FlightDebugInfo;
Expand Down Expand Up @@ -68,7 +68,7 @@ public class LandingZoneJobService {
private final LandingZoneIngressConfiguration ingressConfig;
private final LandingZoneStairwayDatabaseConfiguration stairwayDatabaseConfiguration;
private final ScheduledExecutorService executor;
private final LandingZoneMdcHook mdcHook;
private final StairwayLoggingHook stairwayLoggingHook;
private final StairwayComponent stairwayComponent;
private final LandingZoneFlightBeanBag flightBeanBag;
private final ObjectMapper objectMapper;
Expand All @@ -81,7 +81,7 @@ public LandingZoneJobService(
LandingZoneJobConfiguration jobConfig,
LandingZoneIngressConfiguration ingressConfig,
LandingZoneStairwayDatabaseConfiguration stairwayDatabaseConfiguration,
LandingZoneMdcHook mdcHook,
StairwayLoggingHook stairwayLoggingHook,
@Qualifier("landingZoneStairwayComponent") StairwayComponent stairwayComponent,
LandingZoneFlightBeanBag flightBeanBag,
ObjectMapper objectMapper,
Expand All @@ -91,7 +91,7 @@ public LandingZoneJobService(
this.ingressConfig = ingressConfig;
this.stairwayDatabaseConfiguration = stairwayDatabaseConfiguration;
this.executor = Executors.newScheduledThreadPool(jobConfig.getMaxThreads());
this.mdcHook = mdcHook;
this.stairwayLoggingHook = stairwayLoggingHook;
this.stairwayComponent = stairwayComponent;
this.flightBeanBag = flightBeanBag;
this.objectMapper = objectMapper;
Expand All @@ -101,7 +101,7 @@ public LandingZoneJobService(

// Fully fluent style of JobBuilder
public LandingZoneJobBuilder newJob() {
return new LandingZoneJobBuilder(this, stairwayComponent, mdcHook, openTelemetry);
return new LandingZoneJobBuilder(this, stairwayComponent, openTelemetry);
}

// submit a new job to stairway
Expand Down Expand Up @@ -176,7 +176,7 @@ public void initialize() {
.newStairwayOptionsBuilder()
.dataSource(DataSourceInitializer.initializeDataSource(stairwayDatabaseConfiguration))
.context(flightBeanBag)
.addHook(mdcHook)
.addHook(stairwayLoggingHook)
.addHook(new MonitoringHook(openTelemetry))
.exceptionSerializer(new StairwayExceptionSerializer(objectMapper)));
}
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit d345b2b

Please sign in to comment.