-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
feat: support prometheus new client of micrometer 1.13.0 version #14269
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
63e5bef
fix opentelemetry version change (#14252)
wcy666103 d35d7eb
fix: Disable accesslog while the config is false (#14257)
aofall 95f9984
fix triple reactor call throws "Too many response for unary method" e…
caoyanan666 e489b0f
feat: support prometheus new client of micrometer 1.13.0 version
600f869
Bump com.alibaba.fastjson2:fastjson2 from 2.0.49 to 2.0.51 (#14272)
dependabot[bot] 0baba86
Bump bytebuddy.version from 1.14.15 to 1.14.17 (#14273)
dependabot[bot] 913a9aa
Bump org.apache.maven.plugins:maven-plugin-plugin from 3.13.0 to 3.13…
dependabot[bot] a581afb
Bump org.apache.maven.plugin-tools:maven-plugin-annotations (#14276)
dependabot[bot] 2611350
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.3 to 3.6.0 …
dependabot[bot] 8fee3db
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.3 to 3.7.…
dependabot[bot] 9fde4c9
Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.4.1 to 3.5…
dependabot[bot] 473ea36
fix: Support close the Curator EnsembleTracker (#14281)
aofall 6e6ed8e
Merge branch '3.2' into feat/support_promentheus_new_client
songxiaosheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,10 +29,10 @@ | |
import java.util.concurrent.ScheduledExecutorService; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import io.micrometer.prometheus.PrometheusConfig; | ||
import io.micrometer.prometheus.PrometheusMeterRegistry; | ||
import io.prometheus.client.exporter.BasicAuthHttpConnectionFactory; | ||
import io.prometheus.client.exporter.PushGateway; | ||
import io.micrometer.prometheusmetrics.PrometheusConfig; | ||
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; | ||
import io.prometheus.metrics.exporter.pushgateway.PushGateway; | ||
import io.prometheus.metrics.exporter.pushgateway.PushGateway.Builder; | ||
|
||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_METRICS_COLLECTOR_EXCEPTION; | ||
import static org.apache.dubbo.common.constants.MetricsConstants.PROMETHEUS_DEFAULT_JOB_NAME; | ||
|
@@ -80,11 +80,14 @@ private void schedulePushJob() { | |
|
||
NamedThreadFactory threadFactory = new NamedThreadFactory("prometheus-push-job", true); | ||
pushJobExecutor = Executors.newScheduledThreadPool(1, threadFactory); | ||
PushGateway pushGateway = new PushGateway(baseUrl); | ||
Builder pushGatewayBuilder = PushGateway.builder() | ||
.address(baseUrl) | ||
.job(job) | ||
.registry(prometheusRegistry.getPrometheusRegistry()); | ||
if (!StringUtils.isBlank(username)) { | ||
pushGateway.setConnectionFactory(new BasicAuthHttpConnectionFactory(username, password)); | ||
pushGatewayBuilder.basicAuth(username, password); | ||
} | ||
|
||
PushGateway pushGateway = pushGatewayBuilder.build(); | ||
pushJobExecutor.scheduleWithFixedDelay( | ||
() -> push(pushGateway, job), pushInterval, pushInterval, TimeUnit.SECONDS); | ||
} | ||
|
@@ -93,7 +96,7 @@ private void schedulePushJob() { | |
protected void push(PushGateway pushGateway, String job) { | ||
try { | ||
resetIfSamplesChanged(); | ||
pushGateway.pushAdd(prometheusRegistry.getPrometheusRegistry(), job); | ||
pushGateway.push(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a document available |
||
} catch (IOException e) { | ||
logger.error( | ||
COMMON_METRICS_COLLECTOR_EXCEPTION, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We can only make this breaking change in 3.3