org.macrocloud.kernel.prometheus.config.PrometheusConfiguration Maven / Gradle / Ivy
package org.macrocloud.kernel.prometheus.config;
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import org.macrocloud.kernel.prometheus.endpoint.AgentEndpoint;
import org.macrocloud.kernel.prometheus.endpoint.ServiceEndpoint;
import org.macrocloud.kernel.prometheus.service.RegistrationService;
import org.macrocloud.kernel.launch.props.MacroPropertySource;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Prometheus配置类
*
* @author macro
*/
@Configuration(proxyBeanMethods = false)
@MacroPropertySource(value = "classpath:/kernel-prometheus.yml")
public class PrometheusConfiguration {
@Bean
public RegistrationService registrationService(DiscoveryClient discoveryClient) {
return new RegistrationService(discoveryClient);
}
@Bean
public AgentEndpoint agentController(NacosDiscoveryProperties properties) {
return new AgentEndpoint(properties);
}
@Bean
public ServiceEndpoint serviceController(RegistrationService registrationService) {
return new ServiceEndpoint(registrationService);
}
}