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

[SCB-1990] allow disable metrics endpoints by configuration #1821

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions demo/perf/src/main/resources/microservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ servicecomb:
transport: highway
transport: rest
metrics:
endpoint:
enabled: false
window_time: 1000
invocation.latencyDistribution: 0,1,3,10,100
Consumer.invocation.slow:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.apache.servicecomb.metrics.core.publish.MetricsRestPublisher;
import org.apache.servicecomb.metrics.core.publish.SlowInvocationLogger;

import com.netflix.config.DynamicPropertyFactory;

public class MetricsBootListener implements BootListener {
private MetricsBootstrap metricsBootstrap = new MetricsBootstrap();

Expand All @@ -41,6 +43,10 @@ public SlowInvocationLogger getSlowInvocationLogger() {

@Override
public void onBeforeProducerProvider(BootEvent event) {
if (!DynamicPropertyFactory.getInstance().getBooleanProperty("servicecomb.metrics.endpoint.enabled", true).get()) {
return;
}

event.getScbEngine().getProducerProviderManager()
.addProducerMeta("healthEndpoint", new HealthCheckerRestPublisher());

Expand Down