diff --git a/build.gradle b/build.gradle index f24d8dc..d87ce0a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { - id "org.springframework.boot" version "3.1.1" - id "io.spring.dependency-management" version "1.1.0" + id "org.springframework.boot" version "3.1.3" + id "io.spring.dependency-management" version "1.1.3" id "java" id "jacoco" id "com.diffplug.spotless" version "6.19.0" @@ -49,15 +49,9 @@ dependencies { implementation "ca.uhn.hapi.fhir:hapi-fhir-structures-r4:${hapiVersion}" implementation "ca.uhn.hapi.fhir:hapi-fhir-client-okhttp:${hapiVersion}" - implementation "io.opentracing.contrib:opentracing-spring-web-starter:4.1.0" - implementation "io.opentracing.contrib:opentracing-spring-jaeger-web-starter:3.3.1" - implementation "io.opentracing.contrib:opentracing-spring-jaeger-cloud-starter:3.3.1" - implementation "io.opentracing.contrib:opentracing-okhttp3:3.0.0" - implementation "io.jaegertracing:jaeger-client:1.8.1" - developmentOnly "org.springframework.boot:spring-boot-devtools" runtimeOnly "org.postgresql:postgresql:42.6.0" - runtimeOnly 'com.h2database:h2:2.1.214.redhat-00001' + runtimeOnly 'com.h2database:h2:2.2.222' annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" testImplementation "org.springframework.boot:spring-boot-starter-test" } diff --git a/deploy/docker-compose.exposed.yml b/deploy/docker-compose.exposed.yml index fae3113..c04fd56 100644 --- a/deploy/docker-compose.exposed.yml +++ b/deploy/docker-compose.exposed.yml @@ -1,9 +1,4 @@ services: - jaeger: - ports: - - 127.0.0.1:16686:16686 - - 127.0.0.1:6831:6831/udp - fhir-db: ports: - 127.0.0.1:15432:5432 diff --git a/deploy/docker-compose.gw-deps.yml b/deploy/docker-compose.gw-deps.yml index 4b9858c..23d87b2 100644 --- a/deploy/docker-compose.gw-deps.yml +++ b/deploy/docker-compose.gw-deps.yml @@ -1,28 +1,17 @@ services: - jaeger: - image: jaegertracing/all-in-one:1.45@sha256:5d5c9d2d8c8cbb42f1db4aac1f1f8487bac63da6802004d0da8580fc0c7311a1 - fhir-pseudonymizer: image: ghcr.io/miracum/fhir-pseudonymizer:v2.17.0@sha256:431a7f4516c1f641966c507941b87a997441665656572a1c00c44376ef08fe24 environment: - Tracing__IsEnabled: "true" - Tracing__Jaeger__AgentHost: jaeger - Tracing__Jaeger__AgentPort: 6831 Vfps__Address: "dns:///vfps:8081" UseSystemTextJsonFhirSerializer: "true" PseudonymizationService: "Vfps" volumes: - ${PWD}/deploy/anonymization.yaml:/etc/anonymization.yaml:ro depends_on: - - jaeger - vfps loinc-converter: image: harbor.miracum.org/miracum-etl/loinc-conversion:v1.14.2@sha256:9815eb71c13fa2a0b74df6492f41cc2d7b9969696984e6045b6217600ad1f0e1 - environment: - JAEGER_AGENT_HOST: jaeger - depends_on: - - jaeger vfps-db: image: docker.io/library/postgres:15.3@sha256:31c9342603866f29206a06b77c8fed48b3c3f70d710a4be4e8216b134f92d0df @@ -67,8 +56,6 @@ services: ConnectionStrings__PostgreSQL: "Host=vfps-db:5432;Database=vfps;Timeout=60;Max Auto Prepare=5;Application Name=vfps;Maximum Pool Size=50;" PGUSER: postgres PGPASSWORD: postgres - Tracing__IsEnabled: "true" - Tracing__Jaeger__AgentHost: "jaeger" Pseudonymization__Caching__Namespaces__IsEnabled: "true" depends_on: - vfps-db diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 946195f..3272bd3 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -14,10 +14,7 @@ services: SERVICES_PSQL_ENABLED: ${SERVICES_PSQL_ENABLED:-true} SERVICES_KAFKA_ENABLED: ${SERVICES_KAFKA_ENABLED:-false} BOOTSTRAP_SERVERS: ${BOOTSTRAP_SERVERS:-kafka1:19092} - OPENTRACING_JAEGER_ENABLED: ${OPENTRACING_JAEGER_ENABLED:-true} - OPENTRACING_JAEGER_UDP_SENDER_HOST: ${OPENTRACING_JAEGER_UDP_SENDER_HOST:-jaeger} depends_on: - loinc-converter - fhir-db - - jaeger - fhir-pseudonymizer diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..033e24c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8707e8b..9f4197d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 index 65dcd68..fcb6fca --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +130,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/src/main/java/org/miracum/etl/fhirgateway/AppConfig.java b/src/main/java/org/miracum/etl/fhirgateway/AppConfig.java index 3c55109..bba7c74 100644 --- a/src/main/java/org/miracum/etl/fhirgateway/AppConfig.java +++ b/src/main/java/org/miracum/etl/fhirgateway/AppConfig.java @@ -8,23 +8,12 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; -import io.jaegertracing.internal.propagation.TraceContextCodec; import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.binder.okhttp3.OkHttpMetricsEventListener; -import io.opentracing.Span; -import io.opentracing.contrib.java.spring.jaeger.starter.TracerBuilderCustomizer; -import io.opentracing.contrib.okhttp3.OkHttpClientSpanDecorator; -import io.opentracing.contrib.okhttp3.TracingInterceptor; -import io.opentracing.propagation.Format; -import io.opentracing.util.GlobalTracer; -import java.util.Arrays; import java.util.HashMap; import java.util.concurrent.TimeUnit; -import okhttp3.Connection; import okhttp3.ConnectionPool; import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; import org.miracum.etl.fhirgateway.processors.FhirPseudonymizer; import org.miracum.etl.fhirgateway.processors.IPseudonymizer; import org.miracum.etl.fhirgateway.processors.NoopPseudonymizer; @@ -32,7 +21,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -60,21 +48,6 @@ public FhirContext fhirContext( boolean useLoadBalancerConnectionPool) { var fhirContext = FhirContext.forR4(); - var opNameDecorator = - new OkHttpClientSpanDecorator() { - @Override - public void onRequest(Request request, Span span) { - // add the operation name to the span - span.setOperationName(request.url().encodedPath()); - } - - @Override - public void onError(Throwable throwable, Span span) {} - - @Override - public void onResponse(Connection connection, Response response, Span span) {} - }; - var connectionPool = new ConnectionPool(); if (useLoadBalancerConnectionPool) { connectionPool = @@ -82,15 +55,8 @@ public void onResponse(Connection connection, Response response, Span span) {} MAX_IDLE_CONNECTIONS, KEEP_ALIVE_DURATION_MILLISECONDS, TimeUnit.MILLISECONDS); } - var tracingInterceptor = - new TracingInterceptor( - GlobalTracer.get(), - Arrays.asList(OkHttpClientSpanDecorator.STANDARD_TAGS, opNameDecorator)); - var okclient = new OkHttpClient.Builder() - .addInterceptor(tracingInterceptor) - .addNetworkInterceptor(tracingInterceptor) .connectionPool(connectionPool) .eventListener( OkHttpMetricsEventListener.builder(Metrics.globalRegistry, "fhir.client").build()) @@ -103,21 +69,6 @@ public void onResponse(Connection connection, Response response, Span span) {} return fhirContext; } - @Bean - public TracerBuilderCustomizer traceContextJaegerTracerCustomizer() { - return builder -> { - var injector = new TraceContextCodec.Builder().build(); - - builder - .registerInjector(Format.Builtin.HTTP_HEADERS, injector) - .registerExtractor(Format.Builtin.HTTP_HEADERS, injector); - - builder - .registerInjector(Format.Builtin.TEXT_MAP, injector) - .registerExtractor(Format.Builtin.TEXT_MAP, injector); - }; - } - @Bean public RestTemplate restTemplate(RestTemplateBuilder builder) { return builder.build(); @@ -205,13 +156,4 @@ public IPseudonymizer fhirPseudonymizer( return new NoopPseudonymizer(); } } - - @Bean - @ConditionalOnProperty( - value = "opentracing.jaeger.enabled", - havingValue = "false", - matchIfMissing = false) - public io.opentracing.Tracer jaegerTracer() { - return io.opentracing.noop.NoopTracerFactory.create(); - } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 7f285ce..0bf5045 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -23,11 +23,6 @@ services: match-expression: "fhir\\." replace-with: "fhir.post-gateway-pseuded-" -opentracing: - jaeger: - probabilistic-sampler: - sampling-rate: 1 - log-spans: true spring: datasource: diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ec149e9..ae51ad8 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -44,8 +44,8 @@ spring: key-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.miracum.kafka.serializers.KafkaFhirSerializer cloud: + function.definition: process stream: - function.definition: process bindings: process-in-0: consumer: @@ -102,12 +102,6 @@ fhir: systems: loinc: "http://loinc.org" -opentracing: - jaeger: - udp-sender: - host: localhost - log-spans: false - app: version: 0.0.0-dev