|
16 | 16 |
|
17 | 17 | package io.micrometer.prometheus.rsocket.autoconfigure; |
18 | 18 |
|
19 | | -import io.micrometer.core.instrument.Clock; |
20 | | -import io.micrometer.prometheus.PrometheusConfig; |
21 | 19 | import io.micrometer.prometheus.PrometheusMeterRegistry; |
22 | 20 | import io.micrometer.prometheus.rsocket.PrometheusRSocketClient; |
23 | | -import io.prometheus.client.CollectorRegistry; |
24 | 21 | import org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusMetricsExportAutoConfiguration; |
25 | 22 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
26 | 23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
|
35 | 32 | @AutoConfigureAfter(PrometheusMetricsExportAutoConfiguration.class) |
36 | 33 | @ConditionalOnClass(PrometheusMeterRegistry.class) |
37 | 34 | @ConditionalOnProperty(prefix = "management.metrics.export.prometheus.rsocket", name = "enabled", havingValue = "true", matchIfMissing = true) |
38 | | -@EnableConfigurationProperties(PrometheusRSocketProperties.class) |
39 | | -public class PrometheusRSocketAutoConfiguration { |
40 | | - |
41 | | - @ConditionalOnMissingBean |
42 | | - @Bean |
43 | | - Clock micrometerClock() { |
44 | | - return Clock.SYSTEM; |
45 | | - } |
46 | | - |
47 | | - @ConditionalOnMissingBean |
48 | | - @Bean |
49 | | - PrometheusConfig prometheusConfig() { |
50 | | - return PrometheusConfig.DEFAULT; |
51 | | - } |
52 | | - |
53 | | - @ConditionalOnMissingBean |
54 | | - @Bean |
55 | | - CollectorRegistry prometheusCollectorRegistry() { |
56 | | - return new CollectorRegistry(true); |
57 | | - } |
58 | | - |
59 | | - @ConditionalOnMissingBean |
60 | | - @Bean |
61 | | - PrometheusMeterRegistry prometheusMeterRegistry(PrometheusConfig config, CollectorRegistry collectorRegistry, Clock clock) { |
62 | | - return new PrometheusMeterRegistry(config, collectorRegistry, clock); |
63 | | - } |
| 35 | +@EnableConfigurationProperties(PrometheusRSocketClientProperties.class) |
| 36 | +public class PrometheusRSocketClientAutoConfiguration { |
64 | 37 |
|
65 | 38 | @ConditionalOnMissingBean |
66 | 39 | @Bean(destroyMethod = "pushAndClose") |
67 | | - PrometheusRSocketClient prometheusRSocketClient(PrometheusMeterRegistry meterRegistry, PrometheusRSocketProperties properties) { |
| 40 | + PrometheusRSocketClient prometheusRSocketClient(PrometheusMeterRegistry meterRegistry, PrometheusRSocketClientProperties properties) { |
68 | 41 | return PrometheusRSocketClient.build(meterRegistry, properties.createClientTransport()) |
69 | 42 | .retry(Retry.backoff(properties.getMaxRetries(), properties.getFirstBackoff()) |
70 | 43 | .maxBackoff(properties.getMaxBackoff())) |
|
0 commit comments