From 3af8fa8d1aef8dfae88824b243eb085bec8e4103 Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Wed, 14 Jun 2023 07:57:21 +0200 Subject: [PATCH 1/8] update versions --- build.gradle | 4 ++-- gradle.properties | 18 ++++++++---------- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 5c19e9a..82a7f2c 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ apply plugin: "java" apply plugin: "jacoco" group = "rocks.inspectit.ocelot" -sourceCompatibility = "1.8" +sourceCompatibility = "17" if (!project.hasProperty("buildVersion") || project.getProperty("buildVersion").empty) { ext.buildVersion = "SNAPSHOT" @@ -158,7 +158,7 @@ dependencies { testImplementation( "org.springframework.boot:spring-boot-starter-test", "io.opencensus:opencensus-impl:${openCensusVersion}", - "org.apache.httpcomponents:httpclient", + "org.apache.httpcomponents:httpclient:4.5.14", "org.mockito:mockito-core", "org.junit.jupiter:junit-jupiter-api", "org.awaitility:awaitility", diff --git a/gradle.properties b/gradle.properties index c792463..a63e526 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,15 +2,13 @@ boomerangVersion=1.737.0 # The open-telemetry-boomerang version to ship with the EUM server boomerangOpenTelemetryPluginVersion=0.25.0-6 -# 2.7 is the latest release line which runs on Java 8 -springBootVersion=2.7.11 -# We do not really use snakeyaml directly. We overwrite the version of -# spring due to a security report -# For 1.33 CVE-2022-1471 is still identified. Since EUM-Server -# does not read yaml from untrusted sources, it is not affected. -# We cannot use 2.0 because EUM-Server actually parses a YAML file via Jackson. -# Jackson uses SnakeYaml and cannot deal with version 2.0 -snakeYamlVersion=1.33 +# Upgrade to Spring 3.* and Java 17 +springBootVersion=3.1.0 +# We only use snakeyaml transitively, but we want to force the +# current version due to existing CVEs. +# According to https://github.com/spring-projects/spring-boot/issues/34405 +# this is a safe +snakeYamlVersion=2.0 # Ensure to adapt the netty version (inspectit-ocelot-core/build.gradle) when changing the OpenCensus version openCensusVersion=0.31.1 # pin Prometheus client to 0.6.0 to prevent auto prefixing counter metrics with "_total" @@ -22,7 +20,7 @@ openTelemetryProtoVersion=1.7.1-alpha protobufVersion=3.22.3 guavaVersion=31.1-jre # there are newer version, but they are not compatible with Java 8 -geoip2Version=2.16.1 +geoip2Version=4.0.1 commonsNetVersion=3.9.0 commonsMath3Version=3.6.1 commonsIoVersion=2.11.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69a9715..070cb70 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 22a2bcb7404df26ac7150ec253cf5cc9042405ae Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Wed, 14 Jun 2023 08:00:43 +0200 Subject: [PATCH 2/8] replace javax with jakarta --- .../beacon/processor/ClientHeaderBeaconProcessor.java | 2 +- .../beacon/recorder/ResourceTimingBeaconRecorder.java | 2 +- .../configuration/model/EumServerConfiguration.java | 6 +++--- .../configuration/model/ResourceTimingSettings.java | 4 ++-- .../model/exporters/ExportersSettings.java | 2 +- .../model/exporters/beacon/BeaconExporterSettings.java | 2 +- .../exporters/beacon/BeaconHttpExporterSettings.java | 8 ++++---- .../exporters/metrics/InfluxExporterSettings.java | 4 ++-- .../exporters/metrics/MetricsExportersSettings.java | 2 +- .../exporters/metrics/OtlpMetricsExporterSettings.java | 1 - .../exporters/metrics/PrometheusExporterSettings.java | 6 +++--- .../model/exporters/trace/TraceExportersSettings.java | 2 +- .../definition/BeaconMetricDefinitionSettings.java | 10 +++++----- .../model/metric/definition/BeaconRequirement.java | 4 ++-- .../metric/definition/MetricDefinitionSettings.java | 6 +++--- .../metric/definition/ViewDefinitionSettings.java | 2 +- .../configuration/model/security/SecuritySettings.java | 4 ++-- .../authProvider/AuthenticationProviderSettings.java | 2 +- .../SimpleApiTokenAuthenticationProviderSettings.java | 2 +- .../model/selfmonitoring/SelfMonitoringSettings.java | 6 +++--- .../configuration/model/tags/BeaconTagSettings.java | 4 ++-- .../server/configuration/model/tags/TagsSettings.java | 8 ++++---- .../model/tags/providers/TagsProvidersSettings.java | 2 +- .../eum/server/exporters/InfluxExporterService.java | 4 ++-- .../server/exporters/OtlpMetricsExporterService.java | 7 +++---- .../server/exporters/PrometheusExporterService.java | 4 ++-- .../server/exporters/beacon/BeaconHttpExporter.java | 4 ++-- .../server/exporters/beacon/ExportWorkerFactory.java | 2 +- .../configuration/TraceExportersConfiguration.java | 2 +- .../server/metrics/SelfMonitoringMetricManager.java | 2 +- .../metrics/percentiles/TimeWindowViewManager.java | 4 ++-- .../inspectit/oce/eum/server/rest/TraceController.java | 2 +- .../oce/eum/server/security/ApiTokenFilter.java | 4 ++-- .../SimpleApiTokenAuthenticationProvider.java | 4 ++-- .../opentelemtry/OpenTelemetryProtoConverter.java | 5 +---- .../oce/eum/server/utils/GeolocationResolver.java | 4 ++-- .../rocks/inspectit/oce/eum/server/utils/IPUtils.java | 2 +- .../inspectit/oce/eum/server/utils/RequestUtils.java | 2 +- .../opentelemtry/OpenTelemetryProtoConverterTest.java | 2 +- 39 files changed, 70 insertions(+), 75 deletions(-) diff --git a/src/main/java/rocks/inspectit/oce/eum/server/beacon/processor/ClientHeaderBeaconProcessor.java b/src/main/java/rocks/inspectit/oce/eum/server/beacon/processor/ClientHeaderBeaconProcessor.java index cb8d93c..16b624a 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/beacon/processor/ClientHeaderBeaconProcessor.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/beacon/processor/ClientHeaderBeaconProcessor.java @@ -6,7 +6,7 @@ import rocks.inspectit.oce.eum.server.beacon.Beacon; import rocks.inspectit.oce.eum.server.utils.RequestUtils; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.util.Collections; import java.util.Map; import java.util.function.Supplier; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/beacon/recorder/ResourceTimingBeaconRecorder.java b/src/main/java/rocks/inspectit/oce/eum/server/beacon/recorder/ResourceTimingBeaconRecorder.java index 1bda500..16baf9c 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/beacon/recorder/ResourceTimingBeaconRecorder.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/beacon/recorder/ResourceTimingBeaconRecorder.java @@ -21,7 +21,7 @@ import rocks.inspectit.oce.eum.server.configuration.model.metric.definition.ViewDefinitionSettings; import rocks.inspectit.oce.eum.server.metrics.MeasuresAndViewsManager; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.*; import java.util.function.Function; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/EumServerConfiguration.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/EumServerConfiguration.java index ae0f093..5136dab 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/EumServerConfiguration.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/EumServerConfiguration.java @@ -10,9 +10,9 @@ import rocks.inspectit.oce.eum.server.configuration.model.selfmonitoring.SelfMonitoringSettings; import rocks.inspectit.oce.eum.server.configuration.model.tags.TagsSettings; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.util.Collections; import java.util.Map; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/ResourceTimingSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/ResourceTimingSettings.java index 6d8ed42..0e88520 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/ResourceTimingSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/ResourceTimingSettings.java @@ -3,8 +3,8 @@ import lombok.Data; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.util.Map; /** diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/ExportersSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/ExportersSettings.java index ea2ee9d..fae9555 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/ExportersSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/ExportersSettings.java @@ -6,7 +6,7 @@ import rocks.inspectit.oce.eum.server.configuration.model.exporters.metrics.MetricsExportersSettings; import rocks.inspectit.oce.eum.server.configuration.model.exporters.trace.TraceExportersSettings; -import javax.validation.Valid; +import jakarta.validation.Valid; /** * Extended exporter settings. diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconExporterSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconExporterSettings.java index d194afd..ba423d9 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconExporterSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconExporterSettings.java @@ -3,7 +3,7 @@ import lombok.Data; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; +import jakarta.validation.Valid; /** * Beacon exporter settings. diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconHttpExporterSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconHttpExporterSettings.java index 0744be4..d2993fe 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconHttpExporterSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/beacon/BeaconHttpExporterSettings.java @@ -4,10 +4,10 @@ import org.springframework.validation.annotation.Validated; import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState; -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.AssertTrue; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.time.Duration; /** diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/InfluxExporterSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/InfluxExporterSettings.java index 6e6a017..5a89926 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/InfluxExporterSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/InfluxExporterSettings.java @@ -4,8 +4,8 @@ import org.hibernate.validator.constraints.time.DurationMin; import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; import java.time.Duration; /** diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/MetricsExportersSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/MetricsExportersSettings.java index 0e60518..f8b9597 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/MetricsExportersSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/MetricsExportersSettings.java @@ -3,7 +3,7 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.Valid; +import jakarta.validation.Valid; /** * Settings for metrics exporters. diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/OtlpMetricsExporterSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/OtlpMetricsExporterSettings.java index 1b4b436..b01f548 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/OtlpMetricsExporterSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/OtlpMetricsExporterSettings.java @@ -8,7 +8,6 @@ import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState; import rocks.inspectit.oce.eum.server.configuration.model.exporters.TransportProtocol; -import javax.annotation.PostConstruct; import java.time.Duration; import java.util.Map; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/PrometheusExporterSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/PrometheusExporterSettings.java index 8f696e6..1f95958 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/PrometheusExporterSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/metrics/PrometheusExporterSettings.java @@ -4,9 +4,9 @@ import lombok.NoArgsConstructor; import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; /** * Settings for the OpenCensus Prometheus metrics exporter. diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/trace/TraceExportersSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/trace/TraceExportersSettings.java index 1a65b1a..211a5aa 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/trace/TraceExportersSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/exporters/trace/TraceExportersSettings.java @@ -3,7 +3,7 @@ import lombok.Data; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; +import jakarta.validation.Valid; @Data @Validated diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconMetricDefinitionSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconMetricDefinitionSettings.java index 6b6d208..6728a81 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconMetricDefinitionSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconMetricDefinitionSettings.java @@ -4,11 +4,11 @@ import rocks.inspectit.oce.eum.server.arithmetic.RawExpression; import rocks.inspectit.oce.eum.server.beacon.Beacon; -import javax.validation.Valid; -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.AssertTrue; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import java.util.List; import java.util.Map; import java.util.function.Function; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconRequirement.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconRequirement.java index 06234f8..98a5f60 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconRequirement.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/BeaconRequirement.java @@ -7,8 +7,8 @@ import rocks.inspectit.oce.eum.server.beacon.Beacon; import rocks.inspectit.oce.eum.server.configuration.model.exporters.beacon.InitiatorType; -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.AssertTrue; +import jakarta.validation.constraints.NotNull; import java.util.Collection; import java.util.List; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/MetricDefinitionSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/MetricDefinitionSettings.java index 3be6c64..631742a 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/MetricDefinitionSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/MetricDefinitionSettings.java @@ -3,9 +3,9 @@ import lombok.*; import org.springframework.util.CollectionUtils; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.time.Duration; import java.util.Map; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/ViewDefinitionSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/ViewDefinitionSettings.java index 55e6536..5bd9bb5 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/ViewDefinitionSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/metric/definition/ViewDefinitionSettings.java @@ -4,7 +4,7 @@ import org.hibernate.validator.constraints.time.DurationMin; import org.springframework.util.CollectionUtils; -import javax.validation.constraints.*; +import jakarta.validation.constraints.*; import java.time.Duration; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/SecuritySettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/SecuritySettings.java index 0ab6623..617b003 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/SecuritySettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/SecuritySettings.java @@ -4,8 +4,8 @@ import org.springframework.validation.annotation.Validated; import rocks.inspectit.oce.eum.server.configuration.model.security.authProvider.AuthenticationProviderSettings; -import javax.validation.Valid; -import javax.validation.constraints.NotEmpty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotEmpty; import java.util.List; @Data diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/AuthenticationProviderSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/AuthenticationProviderSettings.java index de8fa75..2b85a31 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/AuthenticationProviderSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/AuthenticationProviderSettings.java @@ -3,7 +3,7 @@ import lombok.Data; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; +import jakarta.validation.Valid; @Data @Validated diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/SimpleApiTokenAuthenticationProviderSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/SimpleApiTokenAuthenticationProviderSettings.java index 4e52f01..9db2ee7 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/SimpleApiTokenAuthenticationProviderSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/security/authProvider/SimpleApiTokenAuthenticationProviderSettings.java @@ -5,7 +5,7 @@ import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.AssertTrue; +import jakarta.validation.constraints.AssertTrue; import java.time.Duration; @Data diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/selfmonitoring/SelfMonitoringSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/selfmonitoring/SelfMonitoringSettings.java index 935c339..2b915e6 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/selfmonitoring/SelfMonitoringSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/selfmonitoring/SelfMonitoringSettings.java @@ -5,9 +5,9 @@ import org.springframework.validation.annotation.Validated; import rocks.inspectit.oce.eum.server.configuration.model.metric.definition.MetricDefinitionSettings; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.util.Collections; import java.util.Map; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/BeaconTagSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/BeaconTagSettings.java index 989f030..5640b50 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/BeaconTagSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/BeaconTagSettings.java @@ -5,8 +5,8 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/TagsSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/TagsSettings.java index 4dc565a..4268d00 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/TagsSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/TagsSettings.java @@ -5,10 +5,10 @@ import rocks.inspectit.oce.eum.server.configuration.model.tags.providers.TagsProvidersSettings; import rocks.inspectit.oce.eum.server.utils.IPUtils; -import javax.validation.Valid; -import javax.validation.constraints.AssertFalse; -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.Pattern; +import jakarta.validation.Valid; +import jakarta.validation.constraints.AssertFalse; +import jakarta.validation.constraints.AssertTrue; +import jakarta.validation.constraints.Pattern; import java.util.*; /** diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/providers/TagsProvidersSettings.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/providers/TagsProvidersSettings.java index 2198e4e..3b55546 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/providers/TagsProvidersSettings.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/tags/providers/TagsProvidersSettings.java @@ -3,7 +3,7 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.Valid; +import jakarta.validation.Valid; @Data @NoArgsConstructor diff --git a/src/main/java/rocks/inspectit/oce/eum/server/exporters/InfluxExporterService.java b/src/main/java/rocks/inspectit/oce/eum/server/exporters/InfluxExporterService.java index 3f2a587..82187d9 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/exporters/InfluxExporterService.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/exporters/InfluxExporterService.java @@ -10,8 +10,8 @@ import rocks.inspectit.oce.eum.server.metrics.percentiles.TimeWindowViewManager; import rocks.inspectit.opencensus.influx.InfluxExporter; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/exporters/OtlpMetricsExporterService.java b/src/main/java/rocks/inspectit/oce/eum/server/exporters/OtlpMetricsExporterService.java index 3126ac7..8c7ffd4 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/exporters/OtlpMetricsExporterService.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/exporters/OtlpMetricsExporterService.java @@ -31,14 +31,13 @@ import rocks.inspectit.oce.eum.server.configuration.model.exporters.TransportProtocol; import rocks.inspectit.oce.eum.server.configuration.model.exporters.metrics.OtlpMetricsExporterSettings; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.validation.Valid; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.validation.Valid; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/exporters/PrometheusExporterService.java b/src/main/java/rocks/inspectit/oce/eum/server/exporters/PrometheusExporterService.java index 51a01ba..09aa3c6 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/exporters/PrometheusExporterService.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/exporters/PrometheusExporterService.java @@ -10,8 +10,8 @@ import org.springframework.stereotype.Component; import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; /** * Service for the Prometheus OpenCensus exporters. diff --git a/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/BeaconHttpExporter.java b/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/BeaconHttpExporter.java index 45b33da..2394e9a 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/BeaconHttpExporter.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/BeaconHttpExporter.java @@ -9,8 +9,8 @@ import rocks.inspectit.oce.eum.server.configuration.model.exporters.beacon.BeaconHttpExporterSettings; import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import java.util.concurrent.*; /** diff --git a/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/ExportWorkerFactory.java b/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/ExportWorkerFactory.java index b7f10d8..c4d8884 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/ExportWorkerFactory.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/exporters/beacon/ExportWorkerFactory.java @@ -18,7 +18,7 @@ import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration; import rocks.inspectit.oce.eum.server.metrics.SelfMonitoringMetricManager; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.net.URI; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/exporters/configuration/TraceExportersConfiguration.java b/src/main/java/rocks/inspectit/oce/eum/server/exporters/configuration/TraceExportersConfiguration.java index f957fa1..28ff260 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/exporters/configuration/TraceExportersConfiguration.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/exporters/configuration/TraceExportersConfiguration.java @@ -22,7 +22,7 @@ import rocks.inspectit.oce.eum.server.configuration.model.exporters.trace.TraceExportersSettings; import rocks.inspectit.oce.eum.server.configuration.model.exporters.trace.JaegerExporterSettings; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.Map; import java.util.Optional; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/metrics/SelfMonitoringMetricManager.java b/src/main/java/rocks/inspectit/oce/eum/server/metrics/SelfMonitoringMetricManager.java index 39bbbea..d6b7e26 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/metrics/SelfMonitoringMetricManager.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/metrics/SelfMonitoringMetricManager.java @@ -9,7 +9,7 @@ import rocks.inspectit.oce.eum.server.configuration.model.selfmonitoring.SelfMonitoringSettings; import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.Collections; import java.util.Map; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/metrics/percentiles/TimeWindowViewManager.java b/src/main/java/rocks/inspectit/oce/eum/server/metrics/percentiles/TimeWindowViewManager.java index a2150f1..83de5c6 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/metrics/percentiles/TimeWindowViewManager.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/metrics/percentiles/TimeWindowViewManager.java @@ -10,8 +10,8 @@ import io.opencensus.tags.Tags; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import java.time.Duration; import java.util.*; import java.util.concurrent.ConcurrentHashMap; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/rest/TraceController.java b/src/main/java/rocks/inspectit/oce/eum/server/rest/TraceController.java index c5b67fc..0b65168 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/rest/TraceController.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/rest/TraceController.java @@ -19,7 +19,7 @@ import rocks.inspectit.oce.eum.server.metrics.SelfMonitoringMetricManager; import rocks.inspectit.oce.eum.server.tracing.opentelemtry.OpenTelemetryProtoConverter; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/security/ApiTokenFilter.java b/src/main/java/rocks/inspectit/oce/eum/server/security/ApiTokenFilter.java index 7e0aa9b..f7e197e 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/security/ApiTokenFilter.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/security/ApiTokenFilter.java @@ -5,8 +5,8 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; import java.io.IOException; /** diff --git a/src/main/java/rocks/inspectit/oce/eum/server/security/authprovider/SimpleApiTokenAuthenticationProvider.java b/src/main/java/rocks/inspectit/oce/eum/server/security/authprovider/SimpleApiTokenAuthenticationProvider.java index a880ee6..8385dab 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/security/authprovider/SimpleApiTokenAuthenticationProvider.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/security/authprovider/SimpleApiTokenAuthenticationProvider.java @@ -21,8 +21,8 @@ import rocks.inspectit.oce.eum.server.security.ApiTokenAuthentication; import rocks.inspectit.oce.eum.server.utils.DirectoryPoller; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import java.io.File; import java.io.IOException; import java.nio.file.Files; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverter.java b/src/main/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverter.java index 784cc8c..7029f91 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverter.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverter.java @@ -7,10 +7,7 @@ import io.opentelemetry.proto.common.v1.InstrumentationLibrary; import io.opentelemetry.proto.trace.v1.InstrumentationLibrarySpans; import io.opentelemetry.proto.trace.v1.ResourceSpans; -import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; -import io.opentelemetry.sdk.common.InstrumentationScopeInfoBuilder; -import io.opentelemetry.sdk.internal.InstrumentationScopeUtil; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.OcelotSpanUtils; import io.opentelemetry.sdk.trace.data.SpanData; @@ -20,7 +17,7 @@ import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration; import rocks.inspectit.oce.eum.server.utils.RequestUtils; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.util.*; import java.util.function.Supplier; import java.util.stream.Stream; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/utils/GeolocationResolver.java b/src/main/java/rocks/inspectit/oce/eum/server/utils/GeolocationResolver.java index 90a2089..5f5f962 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/utils/GeolocationResolver.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/utils/GeolocationResolver.java @@ -6,8 +6,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import java.io.IOException; import java.io.InputStream; import java.net.InetAddress; diff --git a/src/main/java/rocks/inspectit/oce/eum/server/utils/IPUtils.java b/src/main/java/rocks/inspectit/oce/eum/server/utils/IPUtils.java index 56edbc2..9286cc5 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/utils/IPUtils.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/utils/IPUtils.java @@ -4,7 +4,7 @@ import org.springframework.security.web.util.matcher.IpAddressMatcher; import org.springframework.stereotype.Component; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; /** * Util to extract the origin IP from the given request. diff --git a/src/main/java/rocks/inspectit/oce/eum/server/utils/RequestUtils.java b/src/main/java/rocks/inspectit/oce/eum/server/utils/RequestUtils.java index 6242325..561a7bb 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/utils/RequestUtils.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/utils/RequestUtils.java @@ -5,7 +5,7 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class RequestUtils { diff --git a/src/test/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverterTest.java b/src/test/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverterTest.java index 65f21d0..17eb7c4 100644 --- a/src/test/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverterTest.java +++ b/src/test/java/rocks/inspectit/oce/eum/server/tracing/opentelemtry/OpenTelemetryProtoConverterTest.java @@ -23,7 +23,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.Collection; From 79200775697bb64e42e2fccd6d2a3e5d3a1b5c2f Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Wed, 14 Jun 2023 08:02:56 +0200 Subject: [PATCH 3/8] replace SocketUtils with TestSocketUtils --- .../exporters/metrics/PrometheusExporterServiceIntTest.java | 4 ++-- .../eum/server/metrics/SelfMonitoringMetricManagerTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/rocks/inspectit/oce/eum/server/exporters/metrics/PrometheusExporterServiceIntTest.java b/src/test/java/rocks/inspectit/oce/eum/server/exporters/metrics/PrometheusExporterServiceIntTest.java index a1848c3..0bbca76 100644 --- a/src/test/java/rocks/inspectit/oce/eum/server/exporters/metrics/PrometheusExporterServiceIntTest.java +++ b/src/test/java/rocks/inspectit/oce/eum/server/exporters/metrics/PrometheusExporterServiceIntTest.java @@ -17,7 +17,7 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.util.SocketUtils; +import org.springframework.test.util.TestSocketUtils; import rocks.inspectit.oce.eum.server.exporters.ExporterIntMockMvcTestBase; import java.util.Map; @@ -41,7 +41,7 @@ static class EnvInitializer implements ApplicationContextInitializer Date: Wed, 14 Jun 2023 08:43:20 +0200 Subject: [PATCH 4/8] refactor SecurityConfig without WebSecurityConfigurerAdapter --- .../model/BeanConfiguration.java | 7 +++ .../eum/server/security/SecurityConfig.java | 58 ++++++++++--------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/BeanConfiguration.java b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/BeanConfiguration.java index 37587c9..1c7db7e 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/BeanConfiguration.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/configuration/model/BeanConfiguration.java @@ -6,6 +6,8 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.ConversionService; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; import rocks.inspectit.oce.eum.server.configuration.conversion.InspectitConfigConversionService; import java.util.concurrent.Executors; @@ -45,4 +47,9 @@ public ScheduledExecutorService scheduledExecutor() { public ConversionService getConversionService() { return InspectitConfigConversionService.getInstance(); } + + @Bean + public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception { + return config.getAuthenticationManager(); + } } diff --git a/src/main/java/rocks/inspectit/oce/eum/server/security/SecurityConfig.java b/src/main/java/rocks/inspectit/oce/eum/server/security/SecurityConfig.java index a9afaf3..e80a082 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/security/SecurityConfig.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/security/SecurityConfig.java @@ -2,12 +2,15 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration; import rocks.inspectit.oce.eum.server.configuration.model.security.SecuritySettings; @@ -17,11 +20,12 @@ @Slf4j @Configuration -public class SecurityConfig extends WebSecurityConfigurerAdapter { +public class SecurityConfig { + @Autowired + private AuthenticationManager authenticationManager; @Autowired private EumServerConfiguration configuration; - @Autowired(required = false) private List apiTokenAuthProviders = Collections.emptyList(); @@ -30,7 +34,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { * * @param auth the {@link AuthenticationManagerBuilder} to use */ - @Override + @Autowired protected void configure(AuthenticationManagerBuilder auth) { if (configuration.getSecurity().isEnabled()) { apiTokenAuthProviders.forEach(auth::authenticationProvider); @@ -38,38 +42,36 @@ protected void configure(AuthenticationManagerBuilder auth) { } /** - * Configures {@link HttpSecurity} if security is enabeld by + * Configures {@link HttpSecurity} if security is enabled by *
    *
  • Permitting all white listed urls in {@link SecuritySettings#getPermittedUrls()}
  • - *
  • Ensure all other request require authentication
  • + *
  • Ensure all other requests require authentication
  • *
  • add {@link ApiTokenFilter} to filter chain
  • *
* * @param http the {@link HttpSecurity} to modify - * * @throws Exception In case of any error */ - @Override - protected void configure(HttpSecurity http) throws Exception { - http.cors().and().csrf().disable(); + @Bean + protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.cors(AbstractHttpConfigurer::disable).csrf(AbstractHttpConfigurer::disable); if (configuration.getSecurity().isEnabled()) { - http.authorizeRequests() - .antMatchers(configuration.getSecurity().getPermittedUrls().toArray(new String[]{})) - .permitAll() - .anyRequest() - .authenticated() - .and() - .addFilterAt(new ApiTokenFilter(authenticationManagerBean(), configuration.getSecurity() - .getAuthorizationHeader()), BasicAuthenticationFilter.class); - - } else { - http.authorizeRequests().anyRequest().permitAll(); + http.authorizeHttpRequests( + authz -> authz + .requestMatchers(configuration.getSecurity().getPermittedUrls().toArray(new String[]{})) + .permitAll() + .anyRequest() + .authenticated() + ).addFilterAt( + new ApiTokenFilter(authenticationManager, configuration.getSecurity().getAuthorizationHeader()), + BasicAuthenticationFilter.class + ); } + else { + http.authorizeHttpRequests( + authz -> authz.anyRequest().permitAll() + ).httpBasic(Customizer.withDefaults()); + } + return http.build(); } - - @Override - public AuthenticationManager authenticationManagerBean() throws Exception { - return super.authenticationManagerBean(); - } - -} +} \ No newline at end of file From 261d4b972e9d24b96d49f3388ab0a3f9d4876c22 Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Wed, 14 Jun 2023 08:57:05 +0200 Subject: [PATCH 5/8] update comments in gradle.properties --- gradle.properties | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index a63e526..0fe2cf2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,10 +4,7 @@ boomerangVersion=1.737.0 boomerangOpenTelemetryPluginVersion=0.25.0-6 # Upgrade to Spring 3.* and Java 17 springBootVersion=3.1.0 -# We only use snakeyaml transitively, but we want to force the -# current version due to existing CVEs. -# According to https://github.com/spring-projects/spring-boot/issues/34405 -# this is a safe +# CVE-2022-1471 was resolved with SnakeYAML 2.0 snakeYamlVersion=2.0 # Ensure to adapt the netty version (inspectit-ocelot-core/build.gradle) when changing the OpenCensus version openCensusVersion=0.31.1 @@ -19,7 +16,6 @@ openTelemetryAlphaVersion=1.25.0-alpha openTelemetryProtoVersion=1.7.1-alpha protobufVersion=3.22.3 guavaVersion=31.1-jre -# there are newer version, but they are not compatible with Java 8 geoip2Version=4.0.1 commonsNetVersion=3.9.0 commonsMath3Version=3.6.1 From 09001d49f5ba5db29e2e5c1eb03dcb406feb77d5 Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Wed, 14 Jun 2023 10:05:40 +0200 Subject: [PATCH 6/8] update workflow java version --- .github/workflows/eumserver_test.yml | 2 +- gradle.properties | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/eumserver_test.yml b/.github/workflows/eumserver_test.yml index b9edc7e..de9fb48 100644 --- a/.github/workflows/eumserver_test.yml +++ b/.github/workflows/eumserver_test.yml @@ -15,7 +15,7 @@ jobs: test: name: Run Tests runs-on: ubuntu-latest - container: openjdk:8-jdk + container: openjdk:17-jdk-slim steps: - uses: actions/checkout@v3 - name: Grant execute permission for gradlew diff --git a/gradle.properties b/gradle.properties index 0fe2cf2..8e8d0f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,5 +34,4 @@ owaspDependencyCheckVersion=8.2.1 # org.cyclonedx.bom cyclonedxBomVersion=1.7.4 # com.palantir.docker -# There is a newer Version 0.35.0, but it is not Java 8 compatible -palantirDockerVersion=0.34.0 +palantirDockerVersion=0.35.0 From 054675878cc1e2666cbc12e2186e9ab94c735306 Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Fri, 16 Jun 2023 13:27:35 +0200 Subject: [PATCH 7/8] adjust GzipCompressionMethodIntTest --- build.gradle | 1 + gradle.properties | 4 ++-- .../oce/eum/server/rest/BeaconController.java | 4 +++- .../ExporterIntTestBaseWithOtelCollector.java | 19 +++++++++++++++---- .../GzipCompressionMethodIntTest.java | 5 ++--- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 82a7f2c..9916c94 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ apply plugin: "jacoco" group = "rocks.inspectit.ocelot" sourceCompatibility = "17" +targetCompatibility = "17" if (!project.hasProperty("buildVersion") || project.getProperty("buildVersion").empty) { ext.buildVersion = "SNAPSHOT" diff --git a/gradle.properties b/gradle.properties index 8e8d0f6..8c6fc91 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,8 +11,8 @@ openCensusVersion=0.31.1 # pin Prometheus client to 0.6.0 to prevent auto prefixing counter metrics with "_total" # see: https://github.com/prometheus/client_java/issues/640, https://github.com/prometheus/client_java/pull/653 prometheusClientVersion = 0.6.0 -openTelemetryVersion=1.25.0 -openTelemetryAlphaVersion=1.25.0-alpha +openTelemetryVersion=1.27.0 +openTelemetryAlphaVersion=1.27.0-alpha openTelemetryProtoVersion=1.7.1-alpha protobufVersion=3.22.3 guavaVersion=31.1-jre diff --git a/src/main/java/rocks/inspectit/oce/eum/server/rest/BeaconController.java b/src/main/java/rocks/inspectit/oce/eum/server/rest/BeaconController.java index ad4eb38..26fe0a8 100644 --- a/src/main/java/rocks/inspectit/oce/eum/server/rest/BeaconController.java +++ b/src/main/java/rocks/inspectit/oce/eum/server/rest/BeaconController.java @@ -2,6 +2,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.*; @@ -31,9 +32,10 @@ public class BeaconController { private BeaconHttpExporter beaconHttpExporter; @ExceptionHandler({Exception.class}) - public void handleException(Exception exception) { + public ResponseEntity handleException(Exception exception) { selfMonitoringService.record("beacons_received", 1, Collections.singletonMap("is_error", "true")); log.error("Error while receiving beacon", exception); + return new ResponseEntity<>("There was an error", HttpStatus.BAD_REQUEST); } @CrossOrigin diff --git a/src/test/java/rocks/inspectit/oce/eum/server/exporters/ExporterIntTestBaseWithOtelCollector.java b/src/test/java/rocks/inspectit/oce/eum/server/exporters/ExporterIntTestBaseWithOtelCollector.java index 23212b6..8f7e1d0 100644 --- a/src/test/java/rocks/inspectit/oce/eum/server/exporters/ExporterIntTestBaseWithOtelCollector.java +++ b/src/test/java/rocks/inspectit/oce/eum/server/exporters/ExporterIntTestBaseWithOtelCollector.java @@ -47,7 +47,7 @@ public class ExporterIntTestBaseWithOtelCollector extends ExporterIntMockMvcTest protected static final String OTLP_HTTP_METRICS_PATH = "/v1/metrics"; - static final String COLLECTOR_TAG = "0.58.0"; + static final String COLLECTOR_TAG = "0.70.0"; static final String COLLECTOR_IMAGE = "otel/opentelemetry-collector-contrib:" + COLLECTOR_TAG; @@ -223,6 +223,16 @@ protected void awaitMetricsExported(String metricName, double value, ViewDefinit * @param expected whether the value is expected or not */ protected void assertMetric(double value, boolean expected) { + assertMetric(value, expected, ViewDefinitionSettings.Aggregation.SUM); + } + + /** + * Checks if a metric with the given value has been recorded or not + * + * @param value the value + * @param expected whether the value is expected or not + */ + protected void assertMetric(double value, boolean expected, ViewDefinitionSettings.Aggregation aggregation) { assertThat(grpcServer.metricRequests.stream() .anyMatch(mReq -> mReq.getResourceMetricsList() .stream() @@ -230,10 +240,11 @@ protected void assertMetric(double value, boolean expected) { .stream() .anyMatch(iml -> iml.getMetricsList() .stream() - .anyMatch(metric -> metric.getSum() - .getDataPointsList() + .anyMatch(metric -> (aggregation == ViewDefinitionSettings.Aggregation.LAST_VALUE ? + metric.getGauge().getDataPointsList() : metric.getSum().getDataPointsList()) .stream() - .anyMatch(d -> expected ? d.getAsDouble() == value : d.getAsDouble() != value)))))).isTrue(); + .anyMatch(d -> expected ? d.getAsDouble() == value : d.getAsDouble() != value + )))))).isTrue(); } /** diff --git a/src/test/java/rocks/inspectit/oce/eum/server/exporters/GzipCompressionMethodIntTest.java b/src/test/java/rocks/inspectit/oce/eum/server/exporters/GzipCompressionMethodIntTest.java index ff37fe8..babeaf7 100644 --- a/src/test/java/rocks/inspectit/oce/eum/server/exporters/GzipCompressionMethodIntTest.java +++ b/src/test/java/rocks/inspectit/oce/eum/server/exporters/GzipCompressionMethodIntTest.java @@ -95,7 +95,6 @@ void verifyOtlpGrpcMetrics() throws Exception { sendBeacon(beacon); // wait until metrics have been exported awaitMetricsExported(METRIC_END_TIMESTAMP_KEY_NAME, 41, ViewDefinitionSettings.Aggregation.LAST_VALUE); - assertMetric(1334, false); + assertMetric(1334, false, ViewDefinitionSettings.Aggregation.LAST_VALUE); } - -} +} \ No newline at end of file From 681c2d72972b2bc2859e42125c8c12cb2eed9d0d Mon Sep 17 00:00:00 2001 From: EddeCCC Date: Mon, 19 Jun 2023 15:45:58 +0200 Subject: [PATCH 8/8] change download location for OpenTelemetryPlugin --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9916c94..44b6cf6 100644 --- a/build.gradle +++ b/build.gradle @@ -56,7 +56,7 @@ tasks.register('generateVersionFile') { } tasks.register('downloadOpenTelemetryPlugin') { - ext.dest = new File(buildDir, "boomerang-opentelemetry.js") + ext.dest = new File(buildDir, "boomerangjs-${boomerangVersion}/package/plugins/boomerang-opentelemetry.js") outputs.files(ext.dest) doLast { def f = ext.dest