-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathcollector.h
More file actions
47 lines (38 loc) · 1.54 KB
/
collector.h
File metadata and controls
47 lines (38 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
// This component provides an interface, `Collector`, to which spans of
// completed trace segments can be sent.
//
// `DatadogAgent`, defined in `datadog_agent.h`, implements `Collector` by
// serializing the spans and sending them to a Datadog Agent.
//
// As a result of `send`ing spans to a `Collector`, the `TraceSampler` might be
// adjusted to increase or decrease the rate at which traces are kept. See the
// `response_handler` parameter to `Collector::send`.
#include <memory>
#include <vector>
#include "expected.h"
namespace datadog {
namespace tracing {
struct SpanData;
class TraceSampler;
class Collector {
public:
// Submit ownership of the specified `spans` to the collector. If the
// collector delivers a response relevant to trace sampling, reconfigure the
// sampler using the specified `response_handler`. Return an error if one
// occurs.
virtual Expected<void> send(
std::vector<std::unique_ptr<SpanData>>&& spans,
const std::shared_ptr<TraceSampler>& response_handler) = 0;
// Return a JSON representation of this object's configuration. The JSON
// representation is an object with the following properties:
//
// - "type" is the unmangled, qualified name of the most-derived class, e.g.
// "datadog::tracing::DatadogAgent".
// - "config" is an object containing this object's configuration. "config"
// may be omitted if the derived class has no configuration.
virtual std::string config() const = 0;
virtual ~Collector() {}
};
} // namespace tracing
} // namespace datadog