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

refactor: migrate tracing core from boot-start to dubbo deployer #12453

Merged
merged 2 commits into from
Jun 17, 2023

Conversation

conghuhu
Copy link
Contributor

@conghuhu conghuhu commented Jun 4, 2023

What is the purpose of the change

The previous Dubbo Tracing implementation overly relied on the spring boot starter. While providing users with better extensibility, Dubbo Tracing also loses its independence.

So I migrated tracing core from boot-start to dubbo deployer.

Child Task of #12448

Brief changelog

  • Add dubbo-tracing module.
  • Migrated OpenTelemetry tracer, Brave will migrate in the next PR.
  • Transfer zipkin and otlp exporters in OpenTelemetry. Brave's zipkin will be migrated in the next PR.

Usage

Use SpringBoot Starter

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-tracing-otel-zipkin-starter</artifactId>
        </dependency>

Use Dubbo directly

        <!-- dubbo tracing & tracing bridge & exporter -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-tracing</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing-bridge-otel</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-exporter-zipkin</artifactId>
        </dependency>

Verifying this change

Local test result:

d558ce91d92e234a7fba5b7e81a7f6b 672b23c8255b5a48fcdef30d2bd235d

dubbo-samples:apache/dubbo-samples#854

TODO

  • Add Non SpringBoot starter Sample in dubbo-samples.
  • Migrate Brave.

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@conghuhu
Copy link
Contributor Author

conghuhu commented Jun 5, 2023

@songxiaosheng @AlbumenJ @chickenlj PTAL

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2023

Codecov Report

Merging #12453 (096b6fb) into 3.2 (5f39404) will increase coverage by 0.62%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##                3.2   #12453       +/-   ##
=============================================
+ Coverage     68.58%   69.21%    +0.62%     
+ Complexity      338        2      -336     
=============================================
  Files          3607     1637     -1970     
  Lines        168096    67526   -100570     
  Branches      27971     9907    -18064     
=============================================
- Hits         115295    46738    -68557     
+ Misses        42759    16266    -26493     
+ Partials      10042     4522     -5520     

see 2055 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@conghuhu conghuhu force-pushed the tracing branch 3 times, most recently from c34f405 to cc4e9de Compare June 5, 2023 15:31
Copy link
Member

@AlbumenJ AlbumenJ left a comment

Choose a reason for hiding this comment

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

Mode ObservationSenderFilter to dubbo-tracing

@conghuhu
Copy link
Contributor Author

conghuhu commented Jun 6, 2023

ObservationSenderFilter
image

I've finshed to move ObservationSenderFilter @AlbumenJ

songxiaosheng

This comment was marked as duplicate.

Copy link
Member

@songxiaosheng songxiaosheng left a comment

Choose a reason for hiding this comment

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

LGTM

@conghuhu conghuhu force-pushed the tracing branch 4 times, most recently from 2f422e8 to f6b09ba Compare June 12, 2023 13:36

private static boolean isClassPresent(String className) {
return ClassUtils.isPresent(className, DefaultApplicationDeployer.class.getClassLoader());
DubboObservationRegistry dubboObservationRegistry = new DubboObservationRegistry(applicationModel, configOptional.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

So only when all the above three conditions are matched will we initiate DubboObservationRegistry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, due to the Observation.class was proposed after version 1.10 of micrometer, when users use springroot2.x, it defaults to 1.9.x, which means Observation.class is missing. We have made the corresponding judgment and provided users with debug level log prompts.

As for Option, this is the switch that determines whether Dubbo itself has enabled the Tracing function

@conghuhu conghuhu requested a review from chickenlj June 14, 2023 02:07
@sonarcloud
Copy link

sonarcloud bot commented Jun 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 25 Code Smells

47.0% 47.0% Coverage
2.2% 2.2% Duplication

@AlbumenJ AlbumenJ merged commit a613cae into apache:3.2 Jun 17, 2023
AlbumenJ added a commit that referenced this pull request Jun 20, 2023
@AlbumenJ
Copy link
Member

dubbo_provider_requests_total is missing after this PR merged. Revert in ea35f7ed5c1d6d2a6ede821f1481eb5088254d28

conghuhu added a commit to conghuhu/dubbo that referenced this pull request Jun 20, 2023
conghuhu added a commit to conghuhu/dubbo that referenced this pull request Jun 25, 2023
conghuhu added a commit to conghuhu/dubbo that referenced this pull request Jun 27, 2023
AlbumenJ added a commit that referenced this pull request Jun 28, 2023
* recover "refactor: migrate tracing core from boot-start to dubbo deployer (#12453)"

This reverts commit ea35f7e.

* fix: fix missing metrics filter

---------

Co-authored-by: songxiaosheng <songxiaosheng@elastic.link>
Co-authored-by: Albumen Kevin <jhq0812@gmail.com>
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.

5 participants