Line data Source code
1 : #include "source/extensions/stat_sinks/hystrix/config.h" 2 : 3 : #include <memory> 4 : 5 : #include "envoy/config/metrics/v3/stats.pb.h" 6 : #include "envoy/config/metrics/v3/stats.pb.validate.h" 7 : #include "envoy/registry/registry.h" 8 : 9 : #include "source/common/network/resolver_impl.h" 10 : #include "source/extensions/stat_sinks/hystrix/hystrix.h" 11 : 12 : namespace Envoy { 13 : namespace Extensions { 14 : namespace StatSinks { 15 : namespace Hystrix { 16 : 17 : Stats::SinkPtr 18 : HystrixSinkFactory::createStatsSink(const Protobuf::Message& config, 19 0 : Server::Configuration::ServerFactoryContext& server) { 20 0 : const auto& hystrix_sink = 21 0 : MessageUtil::downcastAndValidate<const envoy::config::metrics::v3::HystrixSink&>( 22 0 : config, server.messageValidationContext().staticValidationVisitor()); 23 0 : return std::make_unique<Hystrix::HystrixSink>(server, hystrix_sink.num_buckets()); 24 0 : } 25 : 26 1 : ProtobufTypes::MessagePtr HystrixSinkFactory::createEmptyConfigProto() { 27 1 : return std::make_unique<envoy::config::metrics::v3::HystrixSink>(); 28 1 : } 29 : 30 38 : std::string HystrixSinkFactory::name() const { return HystrixName; } 31 : 32 : /** 33 : * Static registration for the statsd sink factory. @see RegisterFactory. 34 : */ 35 : REGISTER_FACTORY(HystrixSinkFactory, Server::Configuration::StatsSinkFactory); 36 : 37 : } // namespace Hystrix 38 : } // namespace StatSinks 39 : } // namespace Extensions 40 : } // namespace Envoy