From eb2639ac788e4a2479ae500d13bde3b069b95bc3 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 14 Feb 2020 14:06:38 +0100 Subject: [PATCH 1/4] Fix versioning of dropwizard docker for testing --- CHANGELOG.next.asciidoc | 1 + metricbeat/docs/modules/dropwizard.asciidoc | 2 +- metricbeat/module/dropwizard/_meta/Dockerfile | 19 +++++++++-- .../module/dropwizard/_meta/docs.asciidoc | 2 +- .../dropwizard/_meta/supported-versions.yml | 4 +++ .../module/dropwizard/_meta/test/pom.xml | 34 +++++++++++++++++-- .../module/dropwizard/docker-compose.yml | 5 +-- .../module/dropwizard/test_dropwizard.py | 1 + 8 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 metricbeat/module/dropwizard/_meta/supported-versions.yml diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 610e67d80774..4cd3e58884b1 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -155,6 +155,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Improve the `logstash` module (when `xpack.enabled` is set to `true`) to use the override `cluster_uuid` returned by Logstash APIs. {issue}15772[15772] {pull}15795[15795] - Add kubernetes storage class support via kube-state-metrics. {pull}16145[16145] - Add Load Balancing metricset to GCP {pull}15559[15559] +- Add support for Dropwizard metrics 4.1. {pull}[] *Packetbeat* diff --git a/metricbeat/docs/modules/dropwizard.asciidoc b/metricbeat/docs/modules/dropwizard.asciidoc index de8d439fde01..03b5a863f2d0 100644 --- a/metricbeat/docs/modules/dropwizard.asciidoc +++ b/metricbeat/docs/modules/dropwizard.asciidoc @@ -10,7 +10,7 @@ This is the http://dropwizard.io[Dropwizard] module. The default metricset is `c [float] === Compatibility -The Dropwizard module is tested with dropwizard metrics 3.1.0. +The Dropwizard module is tested with dropwizard metrics 3.2.6, 4.0.0 and 4.1.2. [float] diff --git a/metricbeat/module/dropwizard/_meta/Dockerfile b/metricbeat/module/dropwizard/_meta/Dockerfile index 668844b9ef78..bd1ed9072645 100644 --- a/metricbeat/module/dropwizard/_meta/Dockerfile +++ b/metricbeat/module/dropwizard/_meta/Dockerfile @@ -1,9 +1,22 @@ -ARG MAVEN_VERSION -FROM maven:${MAVEN_VERSION} +ARG DROPWIZARD_MAVEN_VERSION +FROM maven:${DROPWIZARD_MAVEN_VERSION} + +# Variables used in pom.xml +ARG DROPWIZARD_VERSION +ENV DROPWIZARD_VERSION=${DROPWIZARD_VERSION} +ARG DROPWIZARD_GROUPID +ENV DROPWIZARD_GROUPID=${DROPWIZARD_GROUPID} + COPY test /test HEALTHCHECK --interval=1s --retries=90 CMD curl -f http://localhost:8080/test/helloworld EXPOSE 8080 WORKDIR /test -CMD mvn jetty:run + +# Install dependencies when building so they are stored in the image +# Change path of local repository because default one is in a volume +ENV MAVEN_OPTS="-Dmaven.repo.local=/opt/m2-repository" +RUN mvn ${MAVEN_OPTS} verify dependency:go-offline + +CMD mvn ${MAVEN_OPTS} --offline jetty:run diff --git a/metricbeat/module/dropwizard/_meta/docs.asciidoc b/metricbeat/module/dropwizard/_meta/docs.asciidoc index 6f9f28bc8cc8..5f20730bc417 100644 --- a/metricbeat/module/dropwizard/_meta/docs.asciidoc +++ b/metricbeat/module/dropwizard/_meta/docs.asciidoc @@ -3,4 +3,4 @@ This is the http://dropwizard.io[Dropwizard] module. The default metricset is `c [float] === Compatibility -The Dropwizard module is tested with dropwizard metrics 3.1.0. +The Dropwizard module is tested with dropwizard metrics 3.2.6, 4.0.0 and 4.1.2. diff --git a/metricbeat/module/dropwizard/_meta/supported-versions.yml b/metricbeat/module/dropwizard/_meta/supported-versions.yml new file mode 100644 index 000000000000..0888fc679e72 --- /dev/null +++ b/metricbeat/module/dropwizard/_meta/supported-versions.yml @@ -0,0 +1,4 @@ +variants: + - DROPWIZARD_VERSION: 4.1.2 + - DROPWIZARD_VERSION: 4.0.0 + - DROPWIZARD_VERSION: 3.2.6 diff --git a/metricbeat/module/dropwizard/_meta/test/pom.xml b/metricbeat/module/dropwizard/_meta/test/pom.xml index 5efba5fb613f..ec8c8e7d711b 100644 --- a/metricbeat/module/dropwizard/_meta/test/pom.xml +++ b/metricbeat/module/dropwizard/_meta/test/pom.xml @@ -17,7 +17,34 @@ io.dropwizard.metrics metrics-servlets - 4.0.0 + ${env.DROPWIZARD_VERSION} + + + + + org.mortbay.jetty + maven-jetty-plugin + 6.1.26 + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + + org.apache.maven + maven-repository-metadata + 2.0.3 + + + org.codehaus.plexus + plexus-utils + 1.1 + + + junit + junit + 3.8.2 @@ -32,8 +59,9 @@ - org.mortbay.jetty - maven-jetty-plugin + org.mortbay.jetty + maven-jetty-plugin + 6.1.26 diff --git a/metricbeat/module/dropwizard/docker-compose.yml b/metricbeat/module/dropwizard/docker-compose.yml index 28347ef8ba20..ee6b7d01e2e2 100644 --- a/metricbeat/module/dropwizard/docker-compose.yml +++ b/metricbeat/module/dropwizard/docker-compose.yml @@ -2,10 +2,11 @@ version: '2.3' services: dropwizard: - image: docker.elastic.co/integrations-ci/beats-dropwizard:${MAVEN_VERSION:-3.3-jdk-8}-1 + image: docker.elastic.co/integrations-ci/beats-dropwizard:${DROPWIZARD_VERSION:-4.1.2}-${DROPWIZARD_MAVEN_VERSION:-3.3-jdk-8}-1 build: context: ./_meta args: - MAVEN_VERSION: ${MAVEN_VERSION:-3.3-jdk-8} + DROPWIZARD_VERSION: ${DROPWIZARD_VERSION:-4.1.2} + DROPWIZARD_MAVEN_VERSION: ${DROPWIZARD_MAVEN_VERSION:-3.3-jdk-8} ports: - 8080 diff --git a/metricbeat/module/dropwizard/test_dropwizard.py b/metricbeat/module/dropwizard/test_dropwizard.py index 767fe4e32c77..8e771c511c2e 100644 --- a/metricbeat/module/dropwizard/test_dropwizard.py +++ b/metricbeat/module/dropwizard/test_dropwizard.py @@ -6,6 +6,7 @@ import metricbeat +@metricbeat.parameterized_with_supported_versions class Test(metricbeat.BaseTest): COMPOSE_SERVICES = ['dropwizard'] From b51e23557b42d27650fcd2c75503dd5fc3a3cee9 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 14 Feb 2020 14:23:33 +0100 Subject: [PATCH 2/4] Use jetty image instead of caching dependencies --- metricbeat/module/dropwizard/_meta/Dockerfile | 21 ++++----- .../module/dropwizard/_meta/test/pom.xml | 45 ------------------- .../module/dropwizard/docker-compose.yml | 3 +- 3 files changed, 9 insertions(+), 60 deletions(-) diff --git a/metricbeat/module/dropwizard/_meta/Dockerfile b/metricbeat/module/dropwizard/_meta/Dockerfile index bd1ed9072645..2ee60473a0d9 100644 --- a/metricbeat/module/dropwizard/_meta/Dockerfile +++ b/metricbeat/module/dropwizard/_meta/Dockerfile @@ -1,22 +1,17 @@ -ARG DROPWIZARD_MAVEN_VERSION -FROM maven:${DROPWIZARD_MAVEN_VERSION} +FROM maven:3.6-jdk-8 # Variables used in pom.xml ARG DROPWIZARD_VERSION ENV DROPWIZARD_VERSION=${DROPWIZARD_VERSION} -ARG DROPWIZARD_GROUPID -ENV DROPWIZARD_GROUPID=${DROPWIZARD_GROUPID} +# Build the deployable war COPY test /test - -HEALTHCHECK --interval=1s --retries=90 CMD curl -f http://localhost:8080/test/helloworld -EXPOSE 8080 - WORKDIR /test +RUN mvn verify -# Install dependencies when building so they are stored in the image -# Change path of local repository because default one is in a volume -ENV MAVEN_OPTS="-Dmaven.repo.local=/opt/m2-repository" -RUN mvn ${MAVEN_OPTS} verify dependency:go-offline +# Build the final image +FROM jetty:9.4.26-jre8 +COPY --from=0 /test/target/test-1.0-SNAPSHOT.war /var/lib/jetty/webapps/test.war -CMD mvn ${MAVEN_OPTS} --offline jetty:run +HEALTHCHECK --interval=1s --retries=90 CMD curl -f http://localhost:8080/test/helloworld +EXPOSE 8080 diff --git a/metricbeat/module/dropwizard/_meta/test/pom.xml b/metricbeat/module/dropwizard/_meta/test/pom.xml index ec8c8e7d711b..e8d4dfb6c81d 100644 --- a/metricbeat/module/dropwizard/_meta/test/pom.xml +++ b/metricbeat/module/dropwizard/_meta/test/pom.xml @@ -19,50 +19,5 @@ metrics-servlets ${env.DROPWIZARD_VERSION} - - - - org.mortbay.jetty - maven-jetty-plugin - 6.1.26 - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - - org.apache.maven - maven-repository-metadata - 2.0.3 - - - org.codehaus.plexus - plexus-utils - 1.1 - - - junit - junit - 3.8.2 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - org.mortbay.jetty - maven-jetty-plugin - 6.1.26 - - - diff --git a/metricbeat/module/dropwizard/docker-compose.yml b/metricbeat/module/dropwizard/docker-compose.yml index ee6b7d01e2e2..4cb6fbd13f05 100644 --- a/metricbeat/module/dropwizard/docker-compose.yml +++ b/metricbeat/module/dropwizard/docker-compose.yml @@ -2,11 +2,10 @@ version: '2.3' services: dropwizard: - image: docker.elastic.co/integrations-ci/beats-dropwizard:${DROPWIZARD_VERSION:-4.1.2}-${DROPWIZARD_MAVEN_VERSION:-3.3-jdk-8}-1 + image: docker.elastic.co/integrations-ci/beats-dropwizard:${DROPWIZARD_VERSION:-4.1.2}-1 build: context: ./_meta args: DROPWIZARD_VERSION: ${DROPWIZARD_VERSION:-4.1.2} - DROPWIZARD_MAVEN_VERSION: ${DROPWIZARD_MAVEN_VERSION:-3.3-jdk-8} ports: - 8080 From c068a377245fc19f61d1e7cfa8697ce101b94121 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 14 Feb 2020 14:45:21 +0100 Subject: [PATCH 3/4] Remove redundant line --- metricbeat/module/dropwizard/_meta/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/metricbeat/module/dropwizard/_meta/Dockerfile b/metricbeat/module/dropwizard/_meta/Dockerfile index 2ee60473a0d9..3098a420da1a 100644 --- a/metricbeat/module/dropwizard/_meta/Dockerfile +++ b/metricbeat/module/dropwizard/_meta/Dockerfile @@ -2,7 +2,6 @@ FROM maven:3.6-jdk-8 # Variables used in pom.xml ARG DROPWIZARD_VERSION -ENV DROPWIZARD_VERSION=${DROPWIZARD_VERSION} # Build the deployable war COPY test /test From c61634d0af588f818cb77bca421751d652d42092 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 14 Feb 2020 14:46:25 +0100 Subject: [PATCH 4/4] Fix changelog --- CHANGELOG.next.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 4cd3e58884b1..5b85c5211781 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -155,7 +155,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Improve the `logstash` module (when `xpack.enabled` is set to `true`) to use the override `cluster_uuid` returned by Logstash APIs. {issue}15772[15772] {pull}15795[15795] - Add kubernetes storage class support via kube-state-metrics. {pull}16145[16145] - Add Load Balancing metricset to GCP {pull}15559[15559] -- Add support for Dropwizard metrics 4.1. {pull}[] +- Add support for Dropwizard metrics 4.1. {pull}16332[16332] *Packetbeat*