Line data Source code
1 : #pragma once 2 : 3 : #include <memory> 4 : #include <string> 5 : #include <vector> 6 : 7 : #include "envoy/common/pure.h" 8 : 9 : namespace Envoy { 10 : namespace Extensions { 11 : namespace Tracers { 12 : namespace Zipkin { 13 : 14 : class Span; 15 : 16 : /** 17 : * This interface must be observed by a Zipkin tracer. 18 : */ 19 : class TracerInterface { 20 : public: 21 : /** 22 : * Destructor. 23 : */ 24 0 : virtual ~TracerInterface() = default; 25 : 26 : /** 27 : * A Zipkin tracer must implement this method. Its implementation must perform whatever 28 : * actions are required when the given span is considered finished. An implementation 29 : * will typically buffer the given span so that it can be flushed later. 30 : * 31 : * This method is invoked by the Span object when its finish() method is called. 32 : * 33 : * @param span The span that needs action. 34 : */ 35 : virtual void reportSpan(Span&& span) PURE; 36 : }; 37 : 38 : /** 39 : * Buffered pending spans serializer. 40 : */ 41 : class Serializer { 42 : public: 43 0 : virtual ~Serializer() = default; 44 : 45 : /** 46 : * Serialize buffered pending spans. 47 : * 48 : * @return std::string serialized buffered pending spans. 49 : */ 50 : virtual std::string serialize(const std::vector<Span>& spans) PURE; 51 : }; 52 : 53 : using SerializerPtr = std::unique_ptr<Serializer>; 54 : 55 : } // namespace Zipkin 56 : } // namespace Tracers 57 : } // namespace Extensions 58 : } // namespace Envoy