-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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
Added support for Micrometer Observation API #11021
Added support for Micrometer Observation API #11021
Conversation
Could you please fix the following Checkstyle issue? [INFO] Starting audit...
Error: /home/runner/work/dubbo/dubbo/dubbo/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/filter/observation/DubboConsumerContext.java:21:8: Unused import - io.micrometer.observation.transport.Kind. [UnusedImports]
Audit done.
[INFO] There is 1 error reported by Checkstyle 8.41 with codestyle/checkstyle.xml ruleset.
Error: src/main/java/org/apache/dubbo/metrics/filter/observation/DubboConsumerContext.java:[21,8] (imports) UnusedImports: Unused import - io.micrometer.observation.transport.Kind.
[INFO] ------------------------------------------------------------------------ |
I am still new to the Observation API, so I need to learn how it works and what advantages can it bring first. |
Hey, sure. I first created an issue here #10742 where I described the advantages and got a green light to start working on this. Is there anything else you want me to add other than what's there in the issue? |
d57460e
to
7460342
Compare
Let me provide an additional explanation. Thanks to this PR, by properly configuring Micrometer Observation ( I've managed to configure that for the Boot samples in core and this is the result in Zipkin And these are the collected metrics: Server
Client
I did my best to follow the experimental OpenTelemetry semantic conventions for tracing and metrics |
7460342
to
9b671da
Compare
dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-provider/pom.xml
Outdated
Show resolved
Hide resolved
...etrics-api/src/main/java/org/apache/dubbo/metrics/filter/observation/DubboClientContext.java
Outdated
Show resolved
Hide resolved
...s-api/src/main/java/org/apache/dubbo/metrics/filter/observation/ObservationSenderFilter.java
Outdated
Show resolved
Hide resolved
...s-api/src/main/java/org/apache/dubbo/metrics/filter/observation/ObservationSenderFilter.java
Outdated
Show resolved
Hide resolved
...s-api/src/main/java/org/apache/dubbo/metrics/filter/observation/ObservationSenderFilter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge this PR into 3.2
branch for new feature purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, a little question. Could be configuration in dubbo-demo
be more simplify?
SonarCloud Quality Gate failed. |
I can remove the Zipkin dependency from the samples - this will simplify things a little bit. However, if you migrate dubbo to use Spring Boot 3, then most of the configuration will be gone because it's done behind the scenes by Boot. |
b549a3f
to
332eb19
Compare
Rebased my branch on top of 3.2 of dubbo |
Ok I fixed the provider side, what else should I do to have this PR merged? |
@CrazyHZM PTAL |
Thanks to @marcingrzejszczak for this contribution, because the content of this PR will directly provide users with the Micrometer Observation function, we need to discuss whether it will be the default implementation of Dubbo, or temporarily used as an SPI EXTENSION(https://github.com/apache/dubbo-spi-extensions). Please give us some time to understand the Micrometer Observation function |
Sure, if you have any questions I'll be more than happy to answer them. |
/** | ||
* Default implementation of the {@link DubboConsumerObservationConvention}. | ||
*/ | ||
public class DefaultDubboServerObservationConvention extends AbstractDefaultDubboObservationConvention implements DubboConsumerObservationConvention { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I think DefaultDubboServerObservationConvention
should implements DubboProviderObservationConvention
, not DubboConsumerObservationConvention
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To tell you the truth I'm completely confused with how dubbo understands receiver and sender (aka client and server aka producer consumer). I think that with this setup I've managed to get proper results in Zipkin (which doesn't mean that I've done this properly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is no problem with the function, but it may prefer client as consumer semantically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the names to Server
and Client
instead of Provider
and Consumer
/** | ||
* Default implementation of the {@link DubboProviderObservationConvention}. | ||
*/ | ||
public class DefaultDubboClientObservationConvention extends AbstractDefaultDubboObservationConvention implements DubboProviderObservationConvention { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I think DefaultDubboClientObservationConvention
should implements DubboConsumerObservationConvention
, not DubboProviderObservationConvention
@@ -0,0 +1,2 @@ | |||
observationreceiver=org.apache.dubbo.metrics.filter.observation.ObservationReceiverFilter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comments below I made on Filter and ClusterFilter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed, because ObservationReceiverFilter
is implements Filter
.
As shown in the figure, put it in the configuration file of org.apache.dubbo.rpc.Filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed, because
ObservationReceiverFilter
is implementsFilter
. As shown in the figure, put it in the configuration file oforg.apache.dubbo.rpc.Filter
Would implementing org.apache.dubbo.rpc.ClusterFilter
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org.apache.dubbo.rpc.ClusterFilter
should be applied to consumer, but ObservationReceiverFilter
is provider.
So ObservationReceiverFilter
shoule implement Filter
...s-api/src/main/java/org/apache/dubbo/metrics/filter/observation/ObservationSenderFilter.java
Show resolved
Hide resolved
ping @marcingrzejszczak |
Yup, I will, thanks :) |
|
||
filter.invoke(invoker, invocation); | ||
|
||
BDDAssertions.then(RpcContext.getClientAttachment().getAttachment("X-B3-TraceId")).isNotEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.filter.ClusterFilter
Show resolved
Hide resolved
@marcingrzejszczak |
Great to hear that! I'll try to review this today and then feel free to merge it :) |
So should I update the PR with your suggestions or I shouldn't touch it at all and just do a review? |
It would of course be best if the issue could be fixed on this PR in time. |
e47c1d3
to
60cb6fe
Compare
Codecov Report
@@ Coverage Diff @@
## 3.2 #11021 +/- ##
============================================
- Coverage 69.62% 64.80% -4.83%
+ Complexity 131 14 -117
============================================
Files 1515 1497 -18
Lines 82452 62498 -19954
Branches 14757 9146 -5611
============================================
- Hits 57408 40499 -16909
+ Misses 20201 17763 -2438
+ Partials 4843 4236 -607
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@marcingrzejszczak Thanks for your kindly contribution. I will merge it later until CI works fine.
|
Actually the whole setup is done manually only because you're not using Boot 3. In Boot 3 all of that is auto-configured.
Micrometer Observation can work with Micrometer Tracing. Micrometer Tracing is an abstraction over tracing that can use OTEL as a bridge. There's nothing you need to change really to make this work with OTel 🤷 BTW you can find this here https://github.com/apache/dubbo/pull/11021/files#diff-dfd2e12c668d7d1cb35baf3117d32272b38a03e0bec26dbd21a324098d90783dR138-R145 |
I have created some spring boot 3 related samples[1] for Dubbo last month. Do you mean that in these samples everything will work fine without any configuration? [1] https://github.com/apache/dubbo-samples/tree/master/10-task
Are you willing to submit relevant demos and documents about this function? It is still very difficult for users who are not familiar with us to use it. 🤯 |
…/metrics/filter/observation/ObservationSenderFilter.java Co-authored-by: Albumen Kevin <[email protected]>
…/metrics/filter/observation/DubboClientContext.java Co-authored-by: Albumen Kevin <[email protected]>
…to context attachment
Fixed the broken test, sorry about that |
20ee4a1
to
fca5473
Compare
If you add the dependencies as presented here then yes, you don't need to pass any configuration. Check this doc https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.micrometer-tracing and https://micrometer.io/docs/tracing
Sure, how can I help? |
Kudos, SonarCloud Quality Gate passed! |
Can you help fill in the documentation for this article? |
there you go apache/dubbo-website#1954 |
What is the purpose of the change
Fixes #10742
Brief changelog
Verifying this change
Checklist