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

Spring Cloud Gateway + Actuator + Micrometer Tracing - not creating a new trace id on each new request #410

Closed
nathandeamer opened this issue Oct 15, 2023 · 7 comments
Labels
invalid This doesn't seem right

Comments

@nathandeamer
Copy link

nathandeamer commented Oct 15, 2023

Spring Cloud Gateway: 2022.0.4
Spring Boot: 3.1.4
Micrometer Tracing: 1.1.6

Every request to /actuator/health is re-using the same trace id despite being separate calls.

How to reproduce:

> docker-compose up
> watch -n 5 curl http://localhost:8080/actuator/health`
> View traces: http://localhost:16686/search
Screenshot 2023-10-15 at 14 31 54

demo.zip

@nathandeamer
Copy link
Author

nathandeamer commented Oct 15, 2023

Looks like once actuator gets called, trace ids stop changing for every subsequent request (to actuator or other endpoint)

Screenshot 2023-10-15 at 14 46 30 275329764-16c67e26-5d0e-41c2-b1b6-5f1a4728e06e
watch -n 5 curl curl localhost:8080/anything/resources
wait 5-10 seconds
watch -n 30 curl localhost:8080/actuator/health

@jonatan-ivanov
Copy link
Member

jonatan-ivanov commented Oct 16, 2023

Could you please try to check what happens if you downgrade to 1.1.4 or upgrade to 1.2.0-RC1?

@chemicL
Copy link
Contributor

chemicL commented Oct 17, 2023

The demo project resolves 1.1.5 of micrometer-tracing. Only micrometer-tracing-bridge-brave gets resolved to 1.1.6. I believe that is the reason for the bug. Please validate after you include:

implementation platform('io.micrometer:micrometer-tracing-bom:1.1.6')

@nathandeamer
Copy link
Author

nathandeamer commented Oct 17, 2023

When micrometer-tracing and micrometer-tracing-bridge-brave both get resolved to 1.1.6 the problem is fixed.

However, I couldn't get implementation platform('io.micrometer:micrometer-tracing-bom:1.1.6') to pull in the correct dependency versions (not sure why, theory is the io.spring.dependency-management plugin is taking priority?)

Instead I imported it this way:

dependencyManagement {
	imports {
		mavenBom 'io.micrometer:micrometer-tracing-bom:1.1.6'
	}
}

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

Result:

./gradlew dependencies --configuration compileClasspath | grep micrometer
+--- io.micrometer:micrometer-tracing-bridge-brave -> 1.1.6
|    +--- io.micrometer:micrometer-tracing:1.1.6
|    |    +--- io.micrometer:micrometer-observation:1.11.5 (*)
|    |    +--- io.micrometer:context-propagation:1.0.6
          |    |    \--- io.micrometer:micrometer-observation:1.10.11 -> 1.11.5 (*)
Screenshot 2023-10-17 at 16 55 02

@nathandeamer
Copy link
Author

nathandeamer commented Oct 17, 2023

Could you please try to check what happens if you downgrade to 1.1.4 or upgrade to 1.2.0-RC1?

1.1.4 and 1.2.0-RC1 both resolve the problem too

dependencyManagement {
	imports {
		mavenBom 'io.micrometer:micrometer-tracing-bom:[1.1.4|1.2.0-RC1]' 
	}
}

@nathandeamer
Copy link
Author

Overriding the versions provided by io.spring.dependency-management plugin would also work:

ext {
	set('micrometer-tracing.version', "1.1.6")
	set('micrometer-tracing-bridge-brave.version', "1.1.6")

}

Looks like the upcoming Spring Boot 3.15 release this week will upgrade micrometer-tracing to 1.1.6
spring-projects/spring-boot#37694

@jonatan-ivanov
Copy link
Member

When micrometer-tracing and micrometer-tracing-bridge-brave both get resolved to 1.1.6 the problem is fixed.

That's great to hear!
3.1.5 should be released on Thursday (in two days: 2023-10-19). You can try out 3.1.5-SNAPSHOT early if you want to check what happens.

With this, let me close the issue, thank you all for looking into this!

@jonatan-ivanov jonatan-ivanov closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2023
@jonatan-ivanov jonatan-ivanov added invalid This doesn't seem right and removed waiting for feedback labels Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants