Skip to content

Add support for Micrometer tracing #30251

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

Closed
wants to merge 1 commit into from

Conversation

mhalbritter
Copy link
Contributor

@mhalbritter mhalbritter commented Mar 16, 2022

Implements auto-configurations for Micrometer Tracing

See gh-30156

So far this auto-configuration supports:

  • Zipkin with a configurable URL, using JSON_V2 encoding and HTTP transport
  • Wavefront with a configurable URL
  • Configurable sampling probability (0% - 100%) for Brave and for OpenTelemetry
  • Brave configured for Zipkin
  • Brave propagation with B3 headers
  • OpenTelemetry configured for Zipkin
  • Micrometer tracing bridges for Brave and OpenTelemetry
  • Micrometer observation handler for tracing
  • Brave configured for Wavefront
  • OpenTelemetry configured for Wavefront

@mhalbritter mhalbritter force-pushed the mh/gh-30156 branch 2 times, most recently from b87a0ad to 3be618c Compare March 21, 2022 12:36
Copy link
Member

@wilkinsona wilkinsona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Mortiz. I've left a few comments for your consideration.

Could you also double-check that any new packages that are introduced have package-info.java files.

@mhalbritter mhalbritter force-pushed the mh/gh-30156 branch 2 times, most recently from ed0d60a to 36b04d6 Compare April 8, 2022 10:00
@mhalbritter
Copy link
Contributor Author

These are the dependency combinations i have tested with and which produce spans in backends:

Zipkin & Brave (no spring-web)

	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	implementation 'io.micrometer:micrometer-tracing-bridge-brave'
	implementation 'io.zipkin.reporter2:zipkin-sender-urlconnection'


Zipkin & Brave (RestTemplate)

	implementation 'org.springframework.boot:spring-boot-starter-actuator'	
	implementation 'io.micrometer:micrometer-tracing-bridge-brave'
	implementation 'org.springframework.boot:spring-boot-starter-web'

Zipkin & Otel (no spring-web)

	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	implementation 'io.micrometer:micrometer-tracing-bridge-otel'
	implementation 'io.zipkin.reporter2:zipkin-sender-urlconnection'
	implementation 'io.opentelemetry:opentelemetry-exporter-zipkin'

Zipkin & Otel (RestTemplate)

	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	implementation 'io.micrometer:micrometer-tracing-bridge-otel'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'io.opentelemetry:opentelemetry-exporter-zipkin'

Wavefront & Otel

	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	implementation 'io.micrometer:micrometer-tracing-bridge-otel'
	implementation 'io.micrometer:micrometer-tracing-reporter-wavefront'

Wavefront & Brave

	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	implementation 'io.micrometer:micrometer-tracing-bridge-brave'
	implementation 'io.micrometer:micrometer-tracing-reporter-wavefront'

For Wavefront, at least the management.wavefront.api-token must be set, otherwise startup fails:

Caused by: org.springframework.boot.context.properties.source.InvalidConfigurationPropertyValueException: Property management.wavefront.api-token with value 'null' is invalid: This property is mandatory whenever publishing directly to the Wavefront API
	at org.springframework.boot.actuate.autoconfigure.wavefront.WavefrontProperties.getApiTokenOrThrow(WavefrontProperties.java:125) ~[classes/:na]
	at org.springframework.boot.actuate.autoconfigure.wavefront.WavefrontAutoConfiguration.wavefrontSender(WavefrontAutoConfiguration.java:51) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:130) ~[spring-beans-6.0.0-M3.jar:6.0.0-M3]
	... 140 common frames omitted

Copy link
Member

@wilkinsona wilkinsona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you. Particular thanks for testing the auto-configurations so thoroughly.

I've left a few comments, almost entirely minor and trivial polishing. The one thing that I think requires some further thought is around the use of spring.application.name. Please take a look and see what you think. My feeling is that we should create a separate issue and review things more broadly as it affects more than this new tracing support.

@mhalbritter
Copy link
Contributor Author

Blocked on micrometer-metrics/tracing#16

@mhalbritter mhalbritter added the status: blocked An issue that's blocked on an external project change label Apr 13, 2022
- Configure Zipkin
- Configure Wavefront
- Configure Brave
- Configure OpenTelemetry
- Configure Micrometer Tracing bridges for OpenTelemetry and Brave
- Create the ObservationHandler for tracing with Micrometer

Closes spring-projectsgh-30156
@mhalbritter mhalbritter removed the status: blocked An issue that's blocked on an external project change label Apr 14, 2022
@mhalbritter
Copy link
Contributor Author

Rebased and put into main, see 3860eb2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants