LCOV - code coverage report
Current view: top level - envoy/server - configuration.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 5 5 100.0 %
Date: 2024-01-05 06:35:25 Functions: 5 5 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <chrono>
       4             : #include <cstdint>
       5             : #include <list>
       6             : #include <memory>
       7             : #include <string>
       8             : #include <vector>
       9             : 
      10             : #include "envoy/config/bootstrap/v3/bootstrap.pb.h"
      11             : #include "envoy/stats/sink.h"
      12             : #include "envoy/upstream/cluster_manager.h"
      13             : 
      14             : #include "absl/types/optional.h"
      15             : 
      16             : namespace Envoy {
      17             : namespace Server {
      18             : namespace Configuration {
      19             : 
      20             : /*
      21             :  * Watchdog configuration.
      22             :  */
      23             : class Watchdog {
      24             : public:
      25         228 :   virtual ~Watchdog() = default;
      26             : 
      27             :   /**
      28             :    * @return std::chrono::milliseconds the time interval after which we count a nonresponsive thread
      29             :    *         event as a "miss" statistic.
      30             :    */
      31             :   virtual std::chrono::milliseconds missTimeout() const PURE;
      32             : 
      33             :   /**
      34             :    * @return std::chrono::milliseconds the time interval after which we count a nonresponsive thread
      35             :    *         event as a "mega miss" statistic.
      36             :    */
      37             :   virtual std::chrono::milliseconds megaMissTimeout() const PURE;
      38             : 
      39             :   /**
      40             :    * @return std::chrono::milliseconds the time interval after which we kill the process due to a
      41             :    *         single nonresponsive thread.
      42             :    */
      43             :   virtual std::chrono::milliseconds killTimeout() const PURE;
      44             : 
      45             :   /**
      46             :    * @return std::chrono::milliseconds the time interval after which we kill the process due to
      47             :    *         multiple nonresponsive threads.
      48             :    */
      49             :   virtual std::chrono::milliseconds multiKillTimeout() const PURE;
      50             : 
      51             :   /**
      52             :    * @return double the percentage of threads that need to meet the MultiKillTimeout before we
      53             :    *         kill the process. This is used in the calculation below
      54             :    *         Max(2, ceil(registered_threads * Fraction(MultiKillThreshold)))
      55             :    *         which computes the number of threads that need to be be nonresponsive
      56             :    *         for at least MultiKillTimeout before we kill the process.
      57             :    */
      58             :   virtual double multiKillThreshold() const PURE;
      59             : 
      60             :   /**
      61             :    * @return Protobuf::RepeatedPtrField<envoy::config::bootstrap::v3::Watchdog::WatchdogAction>
      62             :    *         the WatchDog Actions that trigger on WatchDog Events.
      63             :    */
      64             :   virtual Protobuf::RepeatedPtrField<envoy::config::bootstrap::v3::Watchdog::WatchdogAction>
      65             :   actions() const PURE;
      66             : };
      67             : 
      68             : class StatsConfig {
      69             : public:
      70         157 :   virtual ~StatsConfig() = default;
      71             : 
      72             :   /**
      73             :    * @return std::list<Stats::SinkPtr>& the list of stats sinks initialized from the configuration.
      74             :    */
      75             :   virtual const std::list<Stats::SinkPtr>& sinks() const PURE;
      76             : 
      77             :   /**
      78             :    * @return std::chrono::milliseconds the time interval between flushing to configured stat sinks.
      79             :    *         The server latches counters.
      80             :    */
      81             :   virtual std::chrono::milliseconds flushInterval() const PURE;
      82             : 
      83             :   /**
      84             :    * @return bool indicator to flush stats on-demand via the admin interface instead of on a timer.
      85             :    */
      86             :   virtual bool flushOnAdmin() const PURE;
      87             : 
      88             :   /**
      89             :    * @return true if deferred creation of stats is enabled.
      90             :    */
      91             :   virtual bool enableDeferredCreationStats() const PURE;
      92             : };
      93             : 
      94             : /**
      95             :  * The main server configuration.
      96             :  */
      97             : class Main {
      98             : public:
      99         455 :   virtual ~Main() = default;
     100             : 
     101             :   /**
     102             :    * @return Upstream::ClusterManager* singleton for use by the entire server.
     103             :    *         This will be nullptr if the cluster manager has not initialized yet.
     104             :    */
     105             :   virtual Upstream::ClusterManager* clusterManager() PURE;
     106             : 
     107             :   /**
     108             :    * @return const Upstream::ClusterManager* singleton for use by the entire server.
     109             :    *         This will be nullptr if the cluster manager has not initialized yet.
     110             :    */
     111             :   virtual const Upstream::ClusterManager* clusterManager() const PURE;
     112             : 
     113             :   /**
     114             :    * @return const StatsConfig& the configuration of server stats.
     115             :    */
     116             :   virtual StatsConfig& statsConfig() PURE;
     117             : 
     118             :   /**
     119             :    * @return const Watchdog& the configuration of the main thread watchdog.
     120             :    */
     121             :   virtual const Watchdog& mainThreadWatchdogConfig() const PURE;
     122             : 
     123             :   /**
     124             :    * @return const Watchdog& the configuration of the worker watchdog.
     125             :    */
     126             :   virtual const Watchdog& workerWatchdogConfig() const PURE;
     127             : };
     128             : 
     129             : /**
     130             :  * Admin configuration.
     131             :  */
     132             : class Admin {
     133             : public:
     134         244 :   virtual ~Admin() = default;
     135             : 
     136             :   /**
     137             :    * @return std::list<AccessLog::InstanceSharedPtr> the list of access loggers.
     138             :    */
     139             :   virtual std::list<AccessLog::InstanceSharedPtr> accessLogs() const PURE;
     140             : 
     141             :   /**
     142             :    * @return const std::string& profiler output path.
     143             :    */
     144             :   virtual const std::string& profilePath() const PURE;
     145             : 
     146             :   /**
     147             :    * @return Network::Address::InstanceConstSharedPtr the server address.
     148             :    */
     149             :   virtual Network::Address::InstanceConstSharedPtr address() PURE;
     150             : 
     151             :   /**
     152             :    * @return Network::Address::OptionsSharedPtr the list of listener socket options.
     153             :    */
     154             :   virtual Network::Socket::OptionsSharedPtr socketOptions() PURE;
     155             : 
     156             :   /**
     157             :    * @return bool whether the listener should avoid blocking connections based on the globally set
     158             :    * limit.
     159             :    */
     160             :   virtual bool ignoreGlobalConnLimit() const PURE;
     161             : };
     162             : 
     163             : /**
     164             :  * Initial configuration values that are needed before the main configuration load.
     165             :  */
     166             : class Initial {
     167             : public:
     168         244 :   virtual ~Initial() = default;
     169             : 
     170             :   /**
     171             :    * @return Admin& the admin config.
     172             :    */
     173             :   virtual Admin& admin() PURE;
     174             : 
     175             :   /**
     176             :    * @return absl::optional<std::string> the path to look for flag files.
     177             :    */
     178             :   virtual absl::optional<std::string> flagsPath() const PURE;
     179             : 
     180             :   /**
     181             :    * @return const envoy::config::bootstrap::v2::LayeredRuntime& runtime
     182             :    *         configuration.
     183             :    */
     184             :   virtual const envoy::config::bootstrap::v3::LayeredRuntime& runtime() PURE;
     185             : };
     186             : 
     187             : } // namespace Configuration
     188             : } // namespace Server
     189             : } // namespace Envoy

Generated by: LCOV version 1.15