strimzi / metrics-reporter

Prometheus Metrics Reporter for Apache Kafka server and client compoenents
Apache License 2.0
4 stars 7 forks source link

Error reading assemblies: No assembly descriptors found #24

Closed antonio-pedro99 closed 2 months ago

antonio-pedro99 commented 2 months ago

I am trying to set up the project locally, and facing the following error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project metrics-reporter: Error reading assemblies: No assembly descriptors found. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

From where can I get the assembly descriptor?

mimaison commented 2 months ago

Hi @antonio-pedro99,

The initial import used the maven assembly plugin to generate a JAR with dependencies. It looks like the plugin was removed in https://github.com/strimzi/metrics-reporter/commit/9b8756d7643224614b9f78d2b49e54de6faabd22 by @scholzj. He did keep the version definition but commented it out: https://github.com/strimzi/metrics-reporter/blob/main/pom.xml#L110.

I'm not sure if it was done for a specific reason or if it's only temporary. In the meantime, you can uncomment the version definition and add the following to the plugins section of the pom.xml file:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>${maven.assembly.version}</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals><goal>single</goal></goals>
        </execution>
    </executions>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
    </configuration>
</plugin>
scholzj commented 2 months ago

It is working on the CIs. So I'm not sure this is a problem of something missing but more some kind of environment issue or some issue with what is being run?

mimaison commented 2 months ago

Is the CI running assembly:single? This is the command the README mentions to build the project (and the command I use too to get an uber JAR)

scholzj commented 2 months ago

I guess it does not. And I'm not sure what would such command be even expected to do TBH.

mimaison commented 2 months ago

As mentioned the assembly plugin can be used to produce an uber JAR.

scholzj commented 2 months ago

I know what the assembly plugin does, but I never saw it used in that way. I think it should be removed from the README.

mimaison commented 2 months ago

I think we want to produce an uber JAR for this project. So what do you suggest we do?

scholzj commented 2 months ago

I'm not sure we want to produce Uber JAR. I do not think we tend to do it for other similar projects. We would normally produce the regular JARs and if needed a ZIP / TGZ archive with all the required dependencies.

mimaison commented 2 months ago

Doing my homework and checking other Strimzi projects do, it seems we want to do something similar to what is done in https://github.com/strimzi/kafka-kubernetes-config-provider.

So builds should produce source archives, and archives of the metrics-reporter JAR + JAR dependencies (with the license and readme).

scholzj commented 2 months ago

@mimaison Sounds like a plan. Should I do it?

mimaison commented 2 months ago

Maybe let's see if @OwenCorrigan76 or @antonio-pedro99 would be interested in contributing this? If not, be my guest! Messing with CI/pom is not my favorite pastime :)

OwenCorrigan76 commented 2 months ago

@scholzj @mimaison I'd like to look at this if that's ok guys. Not sure how to go about it so there will be questions if that's also ok.

scholzj commented 2 months ago

@OwenCorrigan76 Sure. Feel free to ping me for help or review.

OwenCorrigan76 commented 2 months ago

Using similar to other Strimzi projects, this is the contents of metrics-reporter-1.0.0-SNAPSHOT.zip

metrics-reporter-1.0.0-SNAPSHOT/
metrics-reporter-1.0.0-SNAPSHOT/libs/
metrics-reporter-1.0.0-SNAPSHOT/LICENSE
metrics-reporter-1.0.0-SNAPSHOT/README.md
metrics-reporter-1.0.0-SNAPSHOT/libs/io.prometheus.simpleclient-0.16.0.jar
metrics-reporter-1.0.0-SNAPSHOT/libs/io.prometheus.simpleclient_tracer_otel-0.16.0.jar
metrics-reporter-1.0.0-SNAPSHOT/libs/io.prometheus.simpleclient_tracer_common-0.16.0.jar
metrics-reporter-1.0.0-SNAPSHOT/libs/io.prometheus.simpleclient_tracer_otel_agent-0.16.0.jar
metrics-reporter-1.0.0-SNAPSHOT/libs/io.prometheus.simpleclient_hotspot-0.16.0.jar
metrics-reporter-1.0.0-SNAPSHOT/libs/io.prometheus.simpleclient_httpserver-0.16.0.jar
metrics-reporter-1.0.0-SNAPSHOT/libs/io.prometheus.simpleclient_common-0.16.0.jar
metrics-reporter-1.0.0-SNAPSHOT/libs/io.strimzi.metrics-reporter-1.0.0-SNAPSHOT.jar

And this is the contents of metrics-reporter-1.0.0-SNAPSHOT.jar:

META-INF/MANIFEST.MF
io/
io/strimzi/
io/strimzi/kafka/
io/strimzi/kafka/metrics/
META-INF/maven/
META-INF/maven/io.strimzi/
META-INF/maven/io.strimzi/metrics-reporter/
io/strimzi/kafka/metrics/YammerPrometheusMetricsReporter.class
io/strimzi/kafka/metrics/KafkaPrometheusMetricsReporter.class
io/strimzi/kafka/metrics/KafkaMetricsCollector.class
io/strimzi/kafka/metrics/PrometheusMetricsReporterConfig$Listener.class
io/strimzi/kafka/metrics/PrometheusMetricsReporterConfig$ListenerValidator.class
io/strimzi/kafka/metrics/PrometheusMetricsReporterConfig.class
io/strimzi/kafka/metrics/MetricFamilySamplesBuilder.class
io/strimzi/kafka/metrics/YammerMetricsCollector.class
META-INF/maven/io.strimzi/metrics-reporter/pom.xml
META-INF/maven/io.strimzi/metrics-reporter/pom.properties

Does this look like all of the dependencies are present for the Metrics Reporter?

This is everything that was in the previously used uber jar:

META-INF/MANIFEST.MF
io/
io/strimzi/
io/strimzi/kafka/
io/strimzi/kafka/metrics/
io/strimzi/kafka/metrics/YammerPrometheusMetricsReporter.class
io/strimzi/kafka/metrics/KafkaPrometheusMetricsReporter.class
io/strimzi/kafka/metrics/KafkaMetricsCollector.class
io/strimzi/kafka/metrics/PrometheusMetricsReporterConfig$Listener.class
io/strimzi/kafka/metrics/PrometheusMetricsReporterConfig$ListenerValidator.class
io/strimzi/kafka/metrics/PrometheusMetricsReporterConfig.class
io/strimzi/kafka/metrics/MetricFamilySamplesBuilder.class
io/strimzi/kafka/metrics/YammerMetricsCollector.class
META-INF/maven/
META-INF/maven/io.prometheus/
META-INF/maven/io.prometheus/simpleclient/
META-INF/maven/io.prometheus/simpleclient/pom.properties
META-INF/maven/io.prometheus/simpleclient/pom.xml
io/prometheus/
io/prometheus/client/
io/prometheus/client/CKMSQuantiles$Quantile.class
io/prometheus/client/CKMSQuantiles$Sample.class
io/prometheus/client/CKMSQuantiles.class
io/prometheus/client/Collector$1.class
io/prometheus/client/Collector$Describable.class
io/prometheus/client/Collector$MetricFamilySamples$Sample.class
io/prometheus/client/Collector$MetricFamilySamples.class
io/prometheus/client/Collector$Type.class
io/prometheus/client/Collector.class
io/prometheus/client/CollectorRegistry$MetricFamilySamplesEnumeration.class
io/prometheus/client/CollectorRegistry.class
io/prometheus/client/Counter$Builder.class
io/prometheus/client/Counter$Child.class
io/prometheus/client/Counter.class
io/prometheus/client/CounterMetricFamily.class
io/prometheus/client/DoubleAdder.class
io/prometheus/client/Enumeration$1.class
io/prometheus/client/Enumeration$Builder.class
io/prometheus/client/Enumeration$Child.class
io/prometheus/client/Enumeration.class
io/prometheus/client/Environment.class
io/prometheus/client/Gauge$1.class
io/prometheus/client/Gauge$Builder.class
io/prometheus/client/Gauge$Child.class
io/prometheus/client/Gauge$TimeProvider.class
io/prometheus/client/Gauge$Timer.class
io/prometheus/client/Gauge.class
io/prometheus/client/GaugeMetricFamily.class
io/prometheus/client/Histogram$1.class
io/prometheus/client/Histogram$Builder.class
io/prometheus/client/Histogram$Child$Value.class
io/prometheus/client/Histogram$Child.class
io/prometheus/client/Histogram$Timer.class
io/prometheus/client/Histogram.class
io/prometheus/client/Info$1.class
io/prometheus/client/Info$Builder.class
io/prometheus/client/Info$Child.class
io/prometheus/client/Info.class
io/prometheus/client/Predicate.class
io/prometheus/client/SampleNameFilter$1.class
io/prometheus/client/SampleNameFilter$AllowAll.class
io/prometheus/client/SampleNameFilter$Builder.class
io/prometheus/client/SampleNameFilter.class
io/prometheus/client/SimpleCollector$Builder.class
io/prometheus/client/SimpleCollector.class
io/prometheus/client/SimpleTimer$TimeProvider.class
io/prometheus/client/SimpleTimer.class
io/prometheus/client/Striped64$Cell.class
io/prometheus/client/Striped64.class
io/prometheus/client/Summary$1.class
io/prometheus/client/Summary$Builder.class
io/prometheus/client/Summary$Child$Value.class
io/prometheus/client/Summary$Child.class
io/prometheus/client/Summary$Timer.class
io/prometheus/client/Summary.class
io/prometheus/client/SummaryMetricFamily.class
io/prometheus/client/Supplier.class
io/prometheus/client/TimeWindowQuantiles.class
io/prometheus/client/exemplars/
io/prometheus/client/exemplars/CounterExemplarSampler.class
io/prometheus/client/exemplars/DefaultExemplarSampler$Clock.class
io/prometheus/client/exemplars/DefaultExemplarSampler$SystemClock.class
io/prometheus/client/exemplars/DefaultExemplarSampler.class
io/prometheus/client/exemplars/Exemplar.class
io/prometheus/client/exemplars/ExemplarConfig.class
io/prometheus/client/exemplars/ExemplarSampler.class
io/prometheus/client/exemplars/HistogramExemplarSampler.class
io/prometheus/client/exemplars/Tracer.class
META-INF/maven/io.prometheus/simpleclient_tracer_otel/
META-INF/maven/io.prometheus/simpleclient_tracer_otel/pom.properties
META-INF/maven/io.prometheus/simpleclient_tracer_otel/pom.xml
io/prometheus/client/exemplars/tracer/
io/prometheus/client/exemplars/tracer/otel/
io/prometheus/client/exemplars/tracer/otel/OpenTelemetrySpanContextSupplier.class
META-INF/maven/io.prometheus/simpleclient_tracer_common/
META-INF/maven/io.prometheus/simpleclient_tracer_common/pom.properties
META-INF/maven/io.prometheus/simpleclient_tracer_common/pom.xml
io/prometheus/client/exemplars/tracer/common/
io/prometheus/client/exemplars/tracer/common/SpanContextSupplier.class
META-INF/maven/io.prometheus/simpleclient_tracer_otel_agent/
META-INF/maven/io.prometheus/simpleclient_tracer_otel_agent/pom.properties
META-INF/maven/io.prometheus/simpleclient_tracer_otel_agent/pom.xml
io/prometheus/client/exemplars/tracer/otel_agent/
io/prometheus/client/exemplars/tracer/otel_agent/OpenTelemetryAgentSpanContextSupplier.class
META-INF/maven/io.prometheus/simpleclient_hotspot/
META-INF/maven/io.prometheus/simpleclient_hotspot/pom.properties
META-INF/maven/io.prometheus/simpleclient_hotspot/pom.xml
io/prometheus/client/hotspot/
io/prometheus/client/hotspot/BufferPoolsExports.class
io/prometheus/client/hotspot/ClassLoadingExports.class
io/prometheus/client/hotspot/DefaultExports.class
io/prometheus/client/hotspot/GarbageCollectorExports.class
io/prometheus/client/hotspot/MemoryAllocationExports$AllocationCountingNotificationListener.class
io/prometheus/client/hotspot/MemoryAllocationExports.class
io/prometheus/client/hotspot/MemoryPoolsExports.class
io/prometheus/client/hotspot/StandardExports$StatusReader.class
io/prometheus/client/hotspot/StandardExports.class
io/prometheus/client/hotspot/ThreadExports.class
io/prometheus/client/hotspot/VersionInfoExports.class
META-INF/maven/io.prometheus/simpleclient_httpserver/
META-INF/maven/io.prometheus/simpleclient_httpserver/pom.properties
META-INF/maven/io.prometheus/simpleclient_httpserver/pom.xml
io/prometheus/client/exporter/
io/prometheus/client/exporter/HTTPServer$1.class
io/prometheus/client/exporter/HTTPServer$Builder.class
io/prometheus/client/exporter/HTTPServer$HTTPMetricHandler.class
io/prometheus/client/exporter/HTTPServer$LocalByteArray.class
io/prometheus/client/exporter/HTTPServer$NamedDaemonThreadFactory.class
io/prometheus/client/exporter/HTTPServer.class
io/prometheus/client/exporter/SampleNameFilterSupplier.class
META-INF/maven/io.prometheus/simpleclient_common/
META-INF/maven/io.prometheus/simpleclient_common/pom.properties
META-INF/maven/io.prometheus/simpleclient_common/pom.xml
io/prometheus/client/exporter/common/
io/prometheus/client/exporter/common/TextFormat$1.class
io/prometheus/client/exporter/common/TextFormat.class

This is the assembly.xml file:

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <id>zip</id>
    <includeBaseDirectory>true</includeBaseDirectory>

    <formats>
        <format>tar.gz</format>
        <format>zip</format>
        <format>dir</format>
    </formats>
    <fileSets>
        <fileSet>
            <directory>${project.basedir}</directory>
            <includes>
                <include>README*</include>
                <include>LICENSE*</include>
            </includes>
            <fileMode>0644</fileMode>
        </fileSet>
    </fileSets>
    <dependencySets>
        <dependencySet>
            <scope>runtime</scope>
            <outputDirectory>libs</outputDirectory>
            <fileMode>0644</fileMode>
            <outputFileNameMapping>${artifact.groupId}.${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
        </dependencySet>
    </dependencySets>
</assembly>
mimaison commented 2 months ago

That looks about right. Can you open a PR so we can take a look?

mimaison commented 2 months ago

Fixed in #27, closing