1
#pragma once
2

            
3
#include <string>
4

            
5
#include "envoy/server/factory_context.h"
6
#include "envoy/server/instance.h"
7

            
8
#include "source/common/config/datasource.h"
9
#include "source/extensions/common/wasm/remote_async_datasource.h"
10
#include "source/server/configuration_impl.h"
11

            
12
namespace Envoy {
13
namespace Extensions {
14
namespace StatSinks {
15
namespace Wasm {
16

            
17
// WebAssembly sink
18
constexpr char WasmName[] = "envoy.stat_sinks.wasm";
19

            
20
/**
21
 * Config registration for the Wasm statsd sink. @see StatSinkFactory.
22
 */
23
class WasmSinkFactory : Logger::Loggable<Logger::Id::config>,
24
                        public Server::Configuration::StatsSinkFactory {
25
public:
26
  // StatsSinkFactory
27
  absl::StatusOr<Stats::SinkPtr>
28
  createStatsSink(const Protobuf::Message& config,
29
                  Server::Configuration::ServerFactoryContext& context) override;
30

            
31
  ProtobufTypes::MessagePtr createEmptyConfigProto() override;
32

            
33
  std::string name() const override;
34

            
35
private:
36
  RemoteAsyncDataProviderPtr remote_data_provider_;
37
};
38

            
39
} // namespace Wasm
40
} // namespace StatSinks
41
} // namespace Extensions
42
} // namespace Envoy