@@ -103,59 +103,107 @@ class BootstrapFactory : public Envoy::Logger::Loggable<Envoy::Logger::Id::main>
103
103
// Implementation of Envoy::Server::Instance. Only methods used by Envoy's code
104
104
// when Nighthawk is running are implemented.
105
105
class NighthawkServerInstance : public Envoy ::Server::Instance {
106
- public:
107
- NighthawkServerInstance (Envoy::Server::Admin& admin, Envoy::Api::Api& api, Envoy::Event::Dispatcher& dispatcher,
106
+ public:
107
+ NighthawkServerInstance (Envoy::Server::Admin& admin, Envoy::Api::Api& api,
108
+ Envoy::Event::Dispatcher& dispatcher,
108
109
Envoy::AccessLog::AccessLogManager& log_manager,
109
- Envoy::Server::Options& options,
110
- Envoy::Runtime::Loader& runtime, Envoy::Singleton::Manager& singleton_manager, Envoy::ThreadLocal::Instance& tls,
111
- Envoy::LocalInfo::LocalInfo& local_info) :
112
- admin_ (admin), api_(api), dispatcher_(dispatcher), log_manager_(log_manager),
113
- options_ (options),
114
- runtime_ (runtime), singleton_manager_(singleton_manager), tls_(tls), local_info_(local_info) {}
110
+ Envoy::Server::Options& options, Envoy::Runtime::Loader& runtime,
111
+ Envoy::Singleton::Manager& singleton_manager,
112
+ Envoy::ThreadLocal::Instance& tls,
113
+ Envoy::LocalInfo::LocalInfo& local_info)
114
+ : admin_(admin), api_(api), dispatcher_(dispatcher), log_manager_(log_manager),
115
+ options_ (options), runtime_(runtime), singleton_manager_(singleton_manager), tls_(tls),
116
+ local_info_(local_info) {}
115
117
116
118
Envoy::Server::Admin& admin () override { return admin_; }
117
119
Envoy::Api::Api& api () override { return api_; }
118
- Envoy::Upstream::ClusterManager& clusterManager () override { PANIC (" NighthawkServerInstance::clusterManager not implemented" ); }
120
+ Envoy::Upstream::ClusterManager& clusterManager () override {
121
+ PANIC (" NighthawkServerInstance::clusterManager not implemented" );
122
+ }
119
123
const Envoy::Upstream::ClusterManager& clusterManager () const override {
120
124
PANIC (" NighthawkServerInstance::clusterManager not implemented" );
121
125
}
122
- Envoy::Ssl::ContextManager& sslContextManager () override { PANIC (" NighthawkServerInstance::sslContextManager not implemented" ); }
126
+ Envoy::Ssl::ContextManager& sslContextManager () override {
127
+ PANIC (" NighthawkServerInstance::sslContextManager not implemented" );
128
+ }
123
129
Envoy::Event::Dispatcher& dispatcher () override { return dispatcher_; }
124
- Envoy::Network::DnsResolverSharedPtr dnsResolver () override { PANIC (" NighthawkServerInstance::dnsResolver not implemented" ); }
125
- void drainListeners () override { PANIC (" NighthawkServerInstance::drainListeners not implemented" ); }
126
- Envoy::Server::DrainManager& drainManager () override { PANIC (" NighthawkServerInstance::drainManager not implemented" ); }
130
+ Envoy::Network::DnsResolverSharedPtr dnsResolver () override {
131
+ PANIC (" NighthawkServerInstance::dnsResolver not implemented" );
132
+ }
133
+ void drainListeners () override {
134
+ PANIC (" NighthawkServerInstance::drainListeners not implemented" );
135
+ }
136
+ Envoy::Server::DrainManager& drainManager () override {
137
+ PANIC (" NighthawkServerInstance::drainManager not implemented" );
138
+ }
127
139
Envoy::AccessLog::AccessLogManager& accessLogManager () override { return log_manager_; }
128
- void failHealthcheck (bool ) override { PANIC (" NighthawkServerInstance::failHealthcheck not implemented" ); }
129
- bool healthCheckFailed () override { PANIC (" NighthawkServerInstance::healthCheckFailed not implemented" ); }
130
- Envoy::Server::HotRestart& hotRestart () override { PANIC (" NighthawkServerInstance::hotRestart not implemented" ); }
131
- Envoy::Init::Manager& initManager () override { PANIC (" NighthawkServerInstance::initManager not implemented" ); }
132
- Envoy::Server::ListenerManager& listenerManager () override { PANIC (" NighthawkServerInstance::listenerManager not implemented" ); }
133
- Envoy::MutexTracer* mutexTracer () override { PANIC (" NighthawkServerInstance::mutexTracer not implemented" ); }
134
- Envoy::Server::OverloadManager& overloadManager () override { PANIC (" NighthawkServerInstance::overloadManager not implemented" ); }
135
- Envoy::Secret::SecretManager& secretManager () override { PANIC (" NighthawkServerInstance::secretManager not implemented" ); }
140
+ void failHealthcheck (bool ) override {
141
+ PANIC (" NighthawkServerInstance::failHealthcheck not implemented" );
142
+ }
143
+ bool healthCheckFailed () override {
144
+ PANIC (" NighthawkServerInstance::healthCheckFailed not implemented" );
145
+ }
146
+ Envoy::Server::HotRestart& hotRestart () override {
147
+ PANIC (" NighthawkServerInstance::hotRestart not implemented" );
148
+ }
149
+ Envoy::Init::Manager& initManager () override {
150
+ PANIC (" NighthawkServerInstance::initManager not implemented" );
151
+ }
152
+ Envoy::Server::ListenerManager& listenerManager () override {
153
+ PANIC (" NighthawkServerInstance::listenerManager not implemented" );
154
+ }
155
+ Envoy::MutexTracer* mutexTracer () override {
156
+ PANIC (" NighthawkServerInstance::mutexTracer not implemented" );
157
+ }
158
+ Envoy::Server::OverloadManager& overloadManager () override {
159
+ PANIC (" NighthawkServerInstance::overloadManager not implemented" );
160
+ }
161
+ Envoy::Secret::SecretManager& secretManager () override {
162
+ PANIC (" NighthawkServerInstance::secretManager not implemented" );
163
+ }
136
164
const Envoy::Server::Options& options () override { return options_; }
137
165
Envoy::Runtime::Loader& runtime () override { return runtime_; }
138
- Envoy::Server::ServerLifecycleNotifier& lifecycleNotifier () override { PANIC (" NighthawkServerInstance::lifecycleNotifier not implemented" ); }
166
+ Envoy::Server::ServerLifecycleNotifier& lifecycleNotifier () override {
167
+ PANIC (" NighthawkServerInstance::lifecycleNotifier not implemented" );
168
+ }
139
169
void shutdown () override { PANIC (" NighthawkServerInstance::shutdown not implemented" ); }
140
170
bool isShutdown () override { PANIC (" NighthawkServerInstance::isShutdown not implemented" ); }
141
171
void shutdownAdmin () override { PANIC (" NighthawkServerInstance::shutdownAdmin not implemented" ); }
142
172
Envoy::Singleton::Manager& singletonManager () override { return singleton_manager_; }
143
- time_t startTimeCurrentEpoch () override { PANIC (" NighthawkServerInstance::startTimeCurrentEpoch not implemented" ); }
144
- time_t startTimeFirstEpoch () override { PANIC (" NighthawkServerInstance::startTimeFirstEpoch not implemented" ); }
173
+ time_t startTimeCurrentEpoch () override {
174
+ PANIC (" NighthawkServerInstance::startTimeCurrentEpoch not implemented" );
175
+ }
176
+ time_t startTimeFirstEpoch () override {
177
+ PANIC (" NighthawkServerInstance::startTimeFirstEpoch not implemented" );
178
+ }
145
179
Envoy::Stats::Store& stats () override { PANIC (" NighthawkServerInstance::stats not implemented" ); }
146
- Envoy::Grpc::Context& grpcContext () override { PANIC (" NighthawkServerInstance::grpcContext not implemented" ); }
147
- Envoy::Http::Context& httpContext () override { PANIC (" NighthawkServerInstance::httpContext not implemented" ); }
148
- Envoy::Router::Context& routerContext () override { PANIC (" NighthawkServerInstance::routerContext not implemented" ); }
149
- Envoy::ProcessContextOptRef processContext () override { PANIC (" NighthawkServerInstance::processContext not implemented" ); }
180
+ Envoy::Grpc::Context& grpcContext () override {
181
+ PANIC (" NighthawkServerInstance::grpcContext not implemented" );
182
+ }
183
+ Envoy::Http::Context& httpContext () override {
184
+ PANIC (" NighthawkServerInstance::httpContext not implemented" );
185
+ }
186
+ Envoy::Router::Context& routerContext () override {
187
+ PANIC (" NighthawkServerInstance::routerContext not implemented" );
188
+ }
189
+ Envoy::ProcessContextOptRef processContext () override {
190
+ PANIC (" NighthawkServerInstance::processContext not implemented" );
191
+ }
150
192
Envoy::ThreadLocal::Instance& threadLocal () override { return tls_; }
151
193
Envoy::LocalInfo::LocalInfo& localInfo () const override { return local_info_; }
152
- Envoy::TimeSource& timeSource () override { PANIC (" NighthawkServerInstance::timeSource not implemented" ); }
194
+ Envoy::TimeSource& timeSource () override {
195
+ PANIC (" NighthawkServerInstance::timeSource not implemented" );
196
+ }
153
197
void flushStats () override { PANIC (" NighthawkServerInstance::flushStats not implemented" ); }
154
198
Envoy::ProtobufMessage::ValidationContext& messageValidationContext () override {
155
199
PANIC (" NighthawkServerInstance::messageValidationContext not implemented" );
156
200
}
157
- Envoy::Server::Configuration::StatsConfig& statsConfig () override { PANIC (" NighthawkServerInstance::statsConfig not implemented" ); }
158
- envoy::config::bootstrap::v3::Bootstrap& bootstrap () override { PANIC (" NighthawkServerInstance::bootstrap not implemented" ); }
201
+ Envoy::Server::Configuration::StatsConfig& statsConfig () override {
202
+ PANIC (" NighthawkServerInstance::statsConfig not implemented" );
203
+ }
204
+ envoy::config::bootstrap::v3::Bootstrap& bootstrap () override {
205
+ PANIC (" NighthawkServerInstance::bootstrap not implemented" );
206
+ }
159
207
Envoy::Server::Configuration::ServerFactoryContext& serverFactoryContext () override {
160
208
PANIC (" NighthawkServerInstance::serverFactoryContext not implemented" );
161
209
}
@@ -166,12 +214,14 @@ class NighthawkServerInstance : public Envoy::Server::Instance {
166
214
void setDefaultTracingConfig (const envoy::config::trace::v3::Tracing&) override {
167
215
PANIC (" NighthawkServerInstance::setDefaultTracingConfig not implemented" );
168
216
}
169
- bool enableReusePortDefault () override { PANIC (" NighthawkServerInstance::enableReusePortDefault not implemented" ); }
217
+ bool enableReusePortDefault () override {
218
+ PANIC (" NighthawkServerInstance::enableReusePortDefault not implemented" );
219
+ }
170
220
void setSinkPredicates (std::unique_ptr<Envoy::Stats::SinkPredicates>&&) override {
171
221
PANIC (" NighthawkServerInstance::setSinkPredicates not implemented" );
172
222
}
173
223
174
- private:
224
+ private:
175
225
Envoy::Server::Admin& admin_;
176
226
Envoy::Api::Api& api_;
177
227
Envoy::Event::Dispatcher& dispatcher_;
@@ -181,12 +231,11 @@ class NighthawkServerInstance : public Envoy::Server::Instance {
181
231
Envoy::Singleton::Manager& singleton_manager_;
182
232
Envoy::ThreadLocal::Instance& tls_;
183
233
Envoy::LocalInfo::LocalInfo& local_info_;
184
-
185
234
};
186
235
187
236
// Implementation of Envoy::Server::Configuration::ServerFactoryContext.
188
237
class NighthawkServerFactoryContext : public Envoy ::Server::Configuration::ServerFactoryContext {
189
- public:
238
+ public:
190
239
NighthawkServerFactoryContext (Envoy::Server::Instance& server) : server_(server) {}
191
240
192
241
const Envoy::Server::Options& options () override { return server_.options (); };
@@ -207,46 +256,66 @@ class NighthawkServerFactoryContext : public Envoy::Server::Configuration::Serve
207
256
return Envoy::ProtobufMessage::getStrictValidationVisitor ();
208
257
};
209
258
210
- Envoy::Stats::Scope& scope () override { PANIC (" NighthawkServerFactoryContext::scope not implemented" ); };
259
+ Envoy::Stats::Scope& scope () override {
260
+ PANIC (" NighthawkServerFactoryContext::scope not implemented" );
261
+ };
211
262
212
- Envoy::Stats::Scope& serverScope () override { PANIC (" NighthawkServerFactoryContext::serverScope not implemented" ); };
263
+ Envoy::Stats::Scope& serverScope () override {
264
+ PANIC (" NighthawkServerFactoryContext::serverScope not implemented" );
265
+ };
213
266
214
267
Envoy::ThreadLocal::SlotAllocator& threadLocal () override { return server_.threadLocal (); }
215
268
216
- Envoy::Upstream::ClusterManager& clusterManager () override { PANIC (" NighthawkServerFactoryContext::clusterManager not implemented" ); };
269
+ Envoy::Upstream::ClusterManager& clusterManager () override {
270
+ PANIC (" NighthawkServerFactoryContext::clusterManager not implemented" );
271
+ };
217
272
218
273
Envoy::ProtobufMessage::ValidationContext& messageValidationContext () override {
219
274
PANIC (" NighthawkServerFactoryContext::messageValidationContext not implemented" );
220
275
};
221
276
222
- Envoy::TimeSource& timeSource () override { PANIC (" NighthawkServerFactoryContext::timeSource not implemented" ); };
277
+ Envoy::TimeSource& timeSource () override {
278
+ PANIC (" NighthawkServerFactoryContext::timeSource not implemented" );
279
+ };
223
280
224
- Envoy::AccessLog::AccessLogManager& accessLogManager () override { return server_.accessLogManager (); }
281
+ Envoy::AccessLog::AccessLogManager& accessLogManager () override {
282
+ return server_.accessLogManager ();
283
+ }
225
284
226
285
Envoy::Server::ServerLifecycleNotifier& lifecycleNotifier () override {
227
286
PANIC (" NighthawkServerFactoryContext::lifecycleNotifier not implemented" );
228
287
};
229
288
230
- Envoy::Init::Manager& initManager () override { PANIC (" NighthawkServerFactoryContext::initManager not implemented" ); };
289
+ Envoy::Init::Manager& initManager () override {
290
+ PANIC (" NighthawkServerFactoryContext::initManager not implemented" );
291
+ };
231
292
232
- Envoy::Grpc::Context& grpcContext () override { PANIC (" NighthawkServerFactoryContext::grpcContext not implemented" ); };
293
+ Envoy::Grpc::Context& grpcContext () override {
294
+ PANIC (" NighthawkServerFactoryContext::grpcContext not implemented" );
295
+ };
233
296
234
- Envoy::Router::Context& routerContext () override { PANIC (" NighthawkServerFactoryContext::routerContext not implemented" ); };
297
+ Envoy::Router::Context& routerContext () override {
298
+ PANIC (" NighthawkServerFactoryContext::routerContext not implemented" );
299
+ };
235
300
236
- Envoy::Server::DrainManager& drainManager () override { PANIC (" NighthawkServerFactoryContext::drainManager not implemented" ); };
301
+ Envoy::Server::DrainManager& drainManager () override {
302
+ PANIC (" NighthawkServerFactoryContext::drainManager not implemented" );
303
+ };
237
304
238
- Envoy::Server::Configuration::StatsConfig& statsConfig () override { PANIC (" NighthawkServerFactoryContext::statsConfig not implemented" ); }
305
+ Envoy::Server::Configuration::StatsConfig& statsConfig () override {
306
+ PANIC (" NighthawkServerFactoryContext::statsConfig not implemented" );
307
+ }
239
308
240
- envoy::config::bootstrap::v3::Bootstrap& bootstrap () override { PANIC (" NighthawkServerFactoryContext::bootstrap not implemented" ); }
309
+ envoy::config::bootstrap::v3::Bootstrap& bootstrap () override {
310
+ PANIC (" NighthawkServerFactoryContext::bootstrap not implemented" );
311
+ }
241
312
242
- private:
313
+ private:
243
314
Envoy::Server::Instance& server_;
244
315
};
245
316
246
317
// Disables the hot restart Envoy functionality.
247
- std::string HotRestartDisabled (bool ) {
248
- return " hot restart is disabled" ;
249
- }
318
+ std::string HotRestartDisabled (bool ) { return " hot restart is disabled" ; }
250
319
251
320
} // namespace
252
321
@@ -622,7 +691,9 @@ bool ProcessImpl::runInternal(OutputCollector& collector, const UriPtr& tracing_
622
691
std::make_unique<Envoy::Extensions::TransportSockets::Tls::ContextManagerImpl>(
623
692
time_system_);
624
693
625
- server_ = std::make_unique<NighthawkServerInstance>(admin_, *api_, *dispatcher_, access_log_manager_, envoy_options_, runtime_singleton_->instance (), *singleton_manager_, tls_, *local_info_);
694
+ server_ = std::make_unique<NighthawkServerInstance>(
695
+ admin_, *api_, *dispatcher_, access_log_manager_, envoy_options_,
696
+ runtime_singleton_->instance (), *singleton_manager_, tls_, *local_info_);
626
697
server_factory_context_ = std::make_unique<NighthawkServerFactoryContext>(*server_);
627
698
cluster_manager_factory_ = std::make_unique<ClusterManagerFactory>(
628
699
*server_factory_context_, admin_, Envoy::Runtime::LoaderSingleton::get (), store_root_, tls_,
0 commit comments