forked from Netflix/conductor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'nw_metrics' into update_api_query_improvement_v2
- Loading branch information
Showing
8 changed files
with
111 additions
and
45 deletions.
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
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
46 changes: 46 additions & 0 deletions
46
server/src/main/java/com/netflix/conductor/config/PrometheusIntegrationConfig.java
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.netflix.conductor.config; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.netflix.spectator.api.Registry; | ||
import com.netflix.spectator.api.Spectator; | ||
import com.netflix.spectator.micrometer.MicrometerRegistry; | ||
import io.micrometer.prometheus.PrometheusMeterRegistry; | ||
import io.micrometer.prometheus.PrometheusRenameFilter; | ||
import io.prometheus.client.CollectorRegistry; | ||
import io.micrometer.prometheus.PrometheusConfig; | ||
import io.micrometer.core.instrument.Clock; | ||
import io.micrometer.core.instrument.Metrics; | ||
|
||
// This class loads all the configurations related to prometheus. | ||
@Configuration | ||
public class PrometheusIntegrationConfig | ||
implements CommandLineRunner { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(PrometheusIntegrationConfig.class); | ||
private static PrometheusMeterRegistry prometheusRegistry; | ||
|
||
public PrometheusIntegrationConfig(PrometheusMeterRegistry prometheusRegistry) { | ||
this.prometheusRegistry = prometheusRegistry; | ||
} | ||
|
||
@Override | ||
public void run(String... args) throws Exception { | ||
setupPrometheusRegistry(); | ||
} | ||
|
||
/** | ||
* To Register PrometheusRegistry | ||
*/ | ||
private static void setupPrometheusRegistry() { | ||
log.info("Registered PrometheusRegistry"); | ||
final MicrometerRegistry metricsRegistry = new MicrometerRegistry(prometheusRegistry); | ||
prometheusRegistry.config().meterFilter(new PrometheusRenameFilter()); | ||
Spectator.globalRegistry().add(metricsRegistry); | ||
} | ||
|
||
} |