LCOV - code coverage report
Current view: top level - source/extensions/health_check/event_sinks/file - file_sink_impl.cc (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 0 14 0.0 %
Date: 2024-01-05 06:35:25 Functions: 0 2 0.0 %

          Line data    Source code
       1             : #include "source/extensions/health_check/event_sinks/file/file_sink_impl.h"
       2             : 
       3             : #include "envoy/registry/registry.h"
       4             : 
       5             : #include "source/common/protobuf/utility.h"
       6             : 
       7             : namespace Envoy {
       8             : namespace Upstream {
       9             : 
      10           0 : void HealthCheckEventFileSink::log(envoy::data::core::v3::HealthCheckEvent event) {
      11           0 : #ifdef ENVOY_ENABLE_YAML
      12             :   // Make sure the type enums make it into the JSON
      13           0 :   const auto json =
      14           0 :       MessageUtil::getJsonStringFromMessageOrError(event, /* pretty_print */ false,
      15           0 :                                                    /* always_print_primitive_fields */ true);
      16           0 :   file_->write(fmt::format("{}\n", json));
      17           0 : #endif
      18           0 : };
      19             : 
      20             : HealthCheckEventSinkPtr HealthCheckEventFileSinkFactory::createHealthCheckEventSink(
      21           0 :     const ProtobufWkt::Any& config, Server::Configuration::HealthCheckerFactoryContext& context) {
      22           0 :   const auto& validator_config = Envoy::MessageUtil::anyConvertAndValidate<
      23           0 :       envoy::extensions::health_check::event_sinks::file::v3::HealthCheckEventFileSink>(
      24           0 :       config, context.messageValidationVisitor());
      25           0 :   return std::make_unique<HealthCheckEventFileSink>(validator_config, context.accessLogManager());
      26           0 : }
      27             : 
      28             : REGISTER_FACTORY(HealthCheckEventFileSinkFactory, HealthCheckEventSinkFactory);
      29             : 
      30             : } // namespace Upstream
      31             : } // namespace Envoy

Generated by: LCOV version 1.15