Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply wider exclusion for zipkin-reporter #362

Closed
jonatan-ivanov opened this issue Sep 21, 2023 · 12 comments
Closed

Apply wider exclusion for zipkin-reporter #362

jonatan-ivanov opened this issue Sep 21, 2023 · 12 comments
Assignees
Labels
bug A general bug build A change in our build-system
Milestone

Comments

@jonatan-ivanov
Copy link
Member

jonatan-ivanov commented Sep 21, 2023

It seems Gradle still brings in the zipkin reporter (io.zipkin.reporter2:zipkin-reporter) if one depends on io.micrometer:micrometer-tracing-bridge-brave.

Reproducer:

plugins {
    id 'java'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.micrometer:micrometer-tracing-bridge-brave:1.+'
}

gradle dependencies produces the following output:

compileClasspath - Compile classpath for source set 'main'.
\--- io.micrometer:micrometer-tracing-bridge-brave:1.+ -> 1.1.5
     +--- io.micrometer:micrometer-tracing:1.1.5
     |    +--- io.micrometer:micrometer-observation:1.11.4
     |    |    \--- io.micrometer:micrometer-commons:1.11.4
     |    +--- io.micrometer:context-propagation:1.0.5
     |    \--- aopalliance:aopalliance:1.0
     +--- org.slf4j:slf4j-api:1.7.36
     +--- io.zipkin.brave:brave:5.14.1
     |    \--- io.zipkin.reporter2:zipkin-reporter-brave:2.16.3
     |         \--- io.zipkin.reporter2:zipkin-reporter:2.16.3
     |              \--- io.zipkin.zipkin2:zipkin:2.23.2
     +--- io.zipkin.brave:brave-context-slf4j:5.14.1
     |    \--- io.zipkin.brave:brave:5.14.1 (*)
     +--- io.zipkin.brave:brave-instrumentation-http:5.14.1
     |    \--- io.zipkin.brave:brave:5.14.1 (*)
     \--- io.zipkin.aws:brave-propagation-aws:0.23.5
          \--- io.zipkin.brave:brave:5.13.7 -> 5.14.1 (*)

Interestingly it works if io.spring.dependency-management plugin is used.

Reported and brainstormed by @alexanderankin and @fbonander on Slack.

@jonatan-ivanov jonatan-ivanov added build A change in our build-system type: task A general task labels Sep 21, 2023
@jonatan-ivanov jonatan-ivanov added this to the 1.0.11 milestone Sep 21, 2023
@jonatan-ivanov jonatan-ivanov self-assigned this Sep 21, 2023
@jonatan-ivanov jonatan-ivanov added bug A general bug and removed type: task A general task labels Sep 21, 2023
@jonatan-ivanov jonatan-ivanov changed the title zipkin-reporter is not always excluded Apply wider exclusion for zipkin-reporter Sep 21, 2023
@wilkinsona
Copy link

Interestingly it works if io.spring.dependency-management plugin is used.

I suspect this is because of the plugin's support for Maven-style exclusions.

@deekshacse1999
Copy link

I have tried all the possible solutions to exclude zipkin, but no success.
Could anyone plz help ?

@fbonander
Copy link

@deekshacse1999 Can you provide any errors? What's your setup?

@alexanderankin
Copy link

alexanderankin commented May 17, 2024

and I guess the dependency versions, which is the output of

https://stackoverflow.com/a/2834352/4971476

mvn dependency:tree

or

./gradlew dependencies

you can add them here by adding a details tag to your comment:

<details><summary>my dependencies</summary>

```
output of your command here
```

</details>

it looks like this when github renders it:

my dependencies
> Task :buildPlugins:extractPluginRequests UP-TO-DATE
> Task :buildPlugins:generatePluginAdapters UP-TO-DATE
> Task :buildPlugins:compileJava UP-TO-DATE
> Task :buildPlugins:compileGroovy NO-SOURCE
> Task :buildPlugins:compileGroovyPlugins UP-TO-DATE
> Task :buildPlugins:pluginDescriptors UP-TO-DATE
> Task :buildPlugins:processResources UP-TO-DATE
> Task :buildPlugins:classes UP-TO-DATE
> Task :buildPlugins:jar UP-TO-DATE

> Task :system:terminal:supports-hyperlinks:dependencies

------------------------------------------------------------
Project ':system:terminal:supports-hyperlinks'
------------------------------------------------------------

annotationProcessor - Annotation processors and their dependencies for source set 'main'.
\--- org.projectlombok:lombok:1.18.30

api - API dependencies for the 'main' feature. (n)
No dependencies

apiElements - API elements for the 'main' feature. (n)
No dependencies

compileClasspath - Compile classpath for source set 'main'.
+--- org.projectlombok:lombok:1.18.30
\--- org.apache.commons:commons-lang3:3.12.0

compileOnly - Compile-only dependencies for the 'main' feature. (n)
\--- org.projectlombok:lombok:1.18.30 (n)

compileOnlyApi - Compile-only API dependencies for the 'main' feature. (n)
No dependencies

coverageDataElementsForTest - Binary data file containing results of Jacoco test coverage reporting for the test Test Suite's test target. (n)
No dependencies

default - Configuration for default artifacts. (n)
No dependencies

implementation - Implementation dependencies for the 'main' feature. (n)
\--- org.apache.commons:commons-lang3:3.12.0 (n)

itestAnnotationProcessor - Annotation processors and their dependencies for source set 'itest'.
\--- org.projectlombok:lombok:1.18.30

itestCompileClasspath - Compile classpath for source set 'itest'.
+--- org.projectlombok:lombok:1.18.30
+--- org.apache.commons:commons-lang3:3.12.0
+--- org.junit.jupiter:junit-jupiter-api:5.8.2
|    +--- org.junit:junit-bom:5.8.2
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.8.2 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-params:5.8.2 (c)
|    |    \--- org.junit.platform:junit-platform-commons:1.8.2 (c)
|    +--- org.opentest4j:opentest4j:1.2.0
|    +--- org.junit.platform:junit-platform-commons:1.8.2
|    |    +--- org.junit:junit-bom:5.8.2 (*)
|    |    \--- org.apiguardian:apiguardian-api:1.1.2
|    \--- org.apiguardian:apiguardian-api:1.1.2
+--- org.junit.jupiter:junit-jupiter-params:5.8.2
|    +--- org.junit:junit-bom:5.8.2 (*)
|    +--- org.junit.jupiter:junit-jupiter-api:5.8.2 (*)
|    \--- org.apiguardian:apiguardian-api:1.1.2
+--- org.hamcrest:hamcrest:2.2
+--- org.mockito:mockito-core:3+ -> 3.12.4
|    +--- net.bytebuddy:byte-buddy:1.11.13
|    +--- net.bytebuddy:byte-buddy-agent:1.11.13
|    \--- org.objenesis:objenesis:3.2
+--- ch.qos.logback:logback-classic:1.2.10
|    +--- ch.qos.logback:logback-core:1.2.10
|    \--- org.slf4j:slf4j-api:1.7.32 -> 1.7.36
\--- com.fasterxml.uuid:java-uuid-generator:4.3.0
     \--- org.slf4j:slf4j-api:1.7.36

itestCompileOnly - Compile only dependencies for source set 'itest'. (n)
No dependencies

itestImplementation - Implementation only dependencies for source set 'itest'. (n)
No dependencies

itestRuntimeClasspath - Runtime classpath of source set 'itest'.
+--- org.apache.commons:commons-lang3:3.12.0
+--- org.junit.jupiter:junit-jupiter-api:5.8.2
|    +--- org.junit:junit-bom:5.8.2
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.8.2 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-engine:5.8.2 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-params:5.8.2 (c)
|    |    +--- org.junit.platform:junit-platform-commons:1.8.2 (c)
|    |    +--- org.junit.platform:junit-platform-engine:1.8.2 (c)
|    |    \--- org.junit.platform:junit-platform-launcher:1.8.2 (c)
|    +--- org.opentest4j:opentest4j:1.2.0
|    \--- org.junit.platform:junit-platform-commons:1.8.2
|         \--- org.junit:junit-bom:5.8.2 (*)
+--- org.junit.jupiter:junit-jupiter-params:5.8.2
|    +--- org.junit:junit-bom:5.8.2 (*)
|    \--- org.junit.jupiter:junit-jupiter-api:5.8.2 (*)
+--- org.hamcrest:hamcrest:2.2
+--- org.mockito:mockito-core:3+ -> 3.12.4
|    +--- net.bytebuddy:byte-buddy:1.11.13
|    +--- net.bytebuddy:byte-buddy-agent:1.11.13
|    \--- org.objenesis:objenesis:3.2
+--- ch.qos.logback:logback-classic:1.2.10
|    +--- ch.qos.logback:logback-core:1.2.10
|    \--- org.slf4j:slf4j-api:1.7.32 -> 1.7.36
+--- com.fasterxml.uuid:java-uuid-generator:4.3.0
|    \--- org.slf4j:slf4j-api:1.7.36
+--- org.junit.jupiter:junit-jupiter-engine:5.8.2
|    +--- org.junit:junit-bom:5.8.2 (*)
|    +--- org.junit.platform:junit-platform-engine:1.8.2
|    |    +--- org.junit:junit-bom:5.8.2 (*)
|    |    +--- org.opentest4j:opentest4j:1.2.0
|    |    \--- org.junit.platform:junit-platform-commons:1.8.2 (*)
|    \--- org.junit.jupiter:junit-jupiter-api:5.8.2 (*)
\--- org.junit.platform:junit-platform-launcher -> 1.8.2
     +--- org.junit:junit-bom:5.8.2 (*)
     \--- org.junit.platform:junit-platform-engine:1.8.2 (*)

itestRuntimeOnly - Runtime only dependencies for source set 'itest'. (n)
No dependencies

jacocoAgent - The Jacoco agent to use to get coverage data.
\--- org.jacoco:org.jacoco.agent:0.8.9

jacocoAnt - The Jacoco ant tasks to use to get execute Gradle tasks.
\--- org.jacoco:org.jacoco.ant:0.8.9
     +--- org.jacoco:org.jacoco.core:0.8.9
     |    +--- org.ow2.asm:asm:9.5
     |    +--- org.ow2.asm:asm-commons:9.5
     |    |    +--- org.ow2.asm:asm:9.5
     |    |    \--- org.ow2.asm:asm-tree:9.5
     |    |         \--- org.ow2.asm:asm:9.5
     |    \--- org.ow2.asm:asm-tree:9.5 (*)
     +--- org.jacoco:org.jacoco.report:0.8.9
     |    \--- org.jacoco:org.jacoco.core:0.8.9 (*)
     \--- org.jacoco:org.jacoco.agent:0.8.9

mainSourceElements - List of source directories contained in the Main SourceSet. (n)
No dependencies

runtimeClasspath - Runtime classpath of source set 'main'.
\--- org.apache.commons:commons-lang3:3.12.0

runtimeElements - Runtime elements for the 'main' feature. (n)
No dependencies

runtimeOnly - Runtime-only dependencies for the 'main' feature. (n)
No dependencies

sourcesElements - sources elements for main. (n)
No dependencies

testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
\--- org.projectlombok:lombok:1.18.30

testCompileClasspath - Compile classpath for source set 'test'.
+--- org.projectlombok:lombok:1.18.30
+--- org.apache.commons:commons-lang3:3.12.0
+--- org.junit.jupiter:junit-jupiter-api:5.8.2
|    +--- org.junit:junit-bom:5.8.2
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.8.2 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-params:5.8.2 (c)
|    |    \--- org.junit.platform:junit-platform-commons:1.8.2 (c)
|    +--- org.opentest4j:opentest4j:1.2.0
|    +--- org.junit.platform:junit-platform-commons:1.8.2
|    |    +--- org.junit:junit-bom:5.8.2 (*)
|    |    \--- org.apiguardian:apiguardian-api:1.1.2
|    \--- org.apiguardian:apiguardian-api:1.1.2
+--- org.junit.jupiter:junit-jupiter-params:5.8.2
|    +--- org.junit:junit-bom:5.8.2 (*)
|    +--- org.junit.jupiter:junit-jupiter-api:5.8.2 (*)
|    \--- org.apiguardian:apiguardian-api:1.1.2
+--- org.hamcrest:hamcrest:2.2
+--- org.mockito:mockito-core:3+ -> 3.12.4
|    +--- net.bytebuddy:byte-buddy:1.11.13
|    +--- net.bytebuddy:byte-buddy-agent:1.11.13
|    \--- org.objenesis:objenesis:3.2
+--- ch.qos.logback:logback-classic:1.2.10
|    +--- ch.qos.logback:logback-core:1.2.10
|    \--- org.slf4j:slf4j-api:1.7.32 -> 1.7.36
\--- com.fasterxml.uuid:java-uuid-generator:4.3.0
     \--- org.slf4j:slf4j-api:1.7.36

testCompileOnly - Compile only dependencies for source set 'test'. (n)
No dependencies

testImplementation - Implementation only dependencies for source set 'test'. (n)
+--- org.junit.jupiter:junit-jupiter-api:5.8.2 (n)
+--- org.junit.jupiter:junit-jupiter-params:5.8.2 (n)
+--- org.hamcrest:hamcrest:2.2 (n)
+--- org.mockito:mockito-core:3+ (n)
+--- ch.qos.logback:logback-classic:1.2.10 (n)
\--- com.fasterxml.uuid:java-uuid-generator:4.3.0 (n)

testRuntimeClasspath - Runtime classpath of source set 'test'.
+--- org.apache.commons:commons-lang3:3.12.0
+--- org.junit.jupiter:junit-jupiter-api:5.8.2
|    +--- org.junit:junit-bom:5.8.2
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.8.2 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-engine:5.8.2 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-params:5.8.2 (c)
|    |    +--- org.junit.platform:junit-platform-commons:1.8.2 (c)
|    |    +--- org.junit.platform:junit-platform-engine:1.8.2 (c)
|    |    \--- org.junit.platform:junit-platform-launcher:1.8.2 (c)
|    +--- org.opentest4j:opentest4j:1.2.0
|    \--- org.junit.platform:junit-platform-commons:1.8.2
|         \--- org.junit:junit-bom:5.8.2 (*)
+--- org.junit.jupiter:junit-jupiter-params:5.8.2
|    +--- org.junit:junit-bom:5.8.2 (*)
|    \--- org.junit.jupiter:junit-jupiter-api:5.8.2 (*)
+--- org.hamcrest:hamcrest:2.2
+--- org.mockito:mockito-core:3+ -> 3.12.4
|    +--- net.bytebuddy:byte-buddy:1.11.13
|    +--- net.bytebuddy:byte-buddy-agent:1.11.13
|    \--- org.objenesis:objenesis:3.2
+--- ch.qos.logback:logback-classic:1.2.10
|    +--- ch.qos.logback:logback-core:1.2.10
|    \--- org.slf4j:slf4j-api:1.7.32 -> 1.7.36
+--- com.fasterxml.uuid:java-uuid-generator:4.3.0
|    \--- org.slf4j:slf4j-api:1.7.36
+--- org.junit.jupiter:junit-jupiter-engine:5.8.2
|    +--- org.junit:junit-bom:5.8.2 (*)
|    +--- org.junit.platform:junit-platform-engine:1.8.2
|    |    +--- org.junit:junit-bom:5.8.2 (*)
|    |    +--- org.opentest4j:opentest4j:1.2.0
|    |    \--- org.junit.platform:junit-platform-commons:1.8.2 (*)
|    \--- org.junit.jupiter:junit-jupiter-api:5.8.2 (*)
\--- org.junit.platform:junit-platform-launcher -> 1.8.2
     +--- org.junit:junit-bom:5.8.2 (*)
     \--- org.junit.platform:junit-platform-engine:1.8.2 (*)

testRuntimeOnly - Runtime only dependencies for source set 'test'. (n)
+--- org.junit.jupiter:junit-jupiter-engine:5.8.2 (n)
\--- org.junit.platform:junit-platform-launcher (n)

(c) - A dependency constraint, not a dependency. The dependency affected by the constraint occurs elsewhere in the tree.
(*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation.

(n) - A dependency or dependency configuration that cannot be resolved.

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 746ms
8 actionable tasks: 1 executed, 7 up-to-date

@deekshacse1999
Copy link

deekshacse1999 commented May 17, 2024

[2024-05-17 15:57:59.477] - 18904 WARNING [main] --- zipkin2.reporter.AsyncReporter$BoundedAsyncReporter: Timed out waiting for in-flight spans to send.
Above mentioned is the error

@deekshacse1999
Copy link

tree.txt
PFB dependency tree

@alexanderankin
Copy link

looks like com.google.cloud:spring-cloud-gcp-starter-trace:5.1.0 is the culprit - with this test:

public class Example {
    public static void main(String[] args) throws Throwable {
        System.out.println(Class.forName("zipkin2.reporter.AsyncReporter"));
    }
}

and this build.gradle file - it works when you comment and uncomment this dep:

plugins {
    id 'java'
}

repositories.mavenCentral()

dependencies {
    implementation 'io.micrometer:micrometer-tracing-bridge-brave:1.2.4'
    implementation 'com.google.cloud:spring-cloud-gcp-starter-trace:5.1.0'
}

tasks.register('zipkintest', JavaExec) {
    it.group 'verification'
    it.description 'zipkintest'
    classpath(sourceSets.main.runtimeClasspath)
    mainClass.set 'Example'
}

@deekshacse1999
Copy link

deekshacse1999 commented May 17, 2024

Okay, any help would be greatly appreciated.

@alexanderankin
Copy link

alexanderankin commented May 17, 2024

i mean spring-cloud-gcp-starter-trace is the reason why zipkin is on your classpath, which is (in my understanding) why it tries to contact a zipkin server, and fails to start up. perhaps the spring cloud project could also exclude zipkin from their library like Jonatan has done for micrometer in this issue.

the code i provided above was to illustrate my point - it is not a solution or a workaround.

@deekshacse1999
Copy link

Please provide any solution, if possible

@alexanderankin
Copy link

alexanderankin commented May 17, 2024

yep the solution is to achieve a zipkin free classpath. stackoverflow, or spring-cloud-gcp-starter-trace github issues may be a better place to ask on how to do that. I don't have a solution off hand - perhaps something like this could be a quick fix - https://stackoverflow.com/a/67423763:

configurations {
    all.collect { configuration ->
        // io.zipkin.reporter2:zipkin-reporter
        configuration.exclude group: 'io.zipkin.reporter2', module: 'zipkin-reporter'
    }
}

@deekshacse1999
Copy link

deekshacse1999 commented May 17, 2024

Thanks now warning for zipkin not coming, but the application still not starting,
Any help would be highly appreciated.
PFB logs:

2024-05-17 19:04:54.632] - 25596 INFO [main] --- org.apache.catalina.core.StandardService: Starting service [Tomcat]
[2024-05-17 19:04:54.638] - 25596 INFO [main] --- org.apache.catalina.core.StandardEngine: Starting Servlet engine: [Apache Tomcat/10.1.19]
[2024-05-17 19:04:54.979] - 25596 INFO [main] --- org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]: Initializing Spring embedded WebApplicationContext
[2024-05-17 19:04:56.678] - 25596 INFO [main] --- org.apache.catalina.core.StandardService: Stopping service [Tomcat]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug build A change in our build-system
Projects
None yet
Development

No branches or pull requests

5 participants