Skip to content

Commit 7a3a6c5

Browse files
committed
[skip ci] remove unecessary changes
1 parent 36f0250 commit 7a3a6c5

17 files changed

+41
-287
lines changed

include/datadog/collector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace datadog {
1919
namespace tracing {
2020

2121
struct SpanData;
22-
class ErasedTraceSampler;
22+
class TraceSampler;
2323

2424
class Collector {
2525
public:
@@ -29,7 +29,7 @@ class Collector {
2929
// occurs.
3030
virtual Expected<void> send(
3131
std::vector<std::unique_ptr<SpanData>>&& spans,
32-
const std::shared_ptr<ErasedTraceSampler>& response_handler) = 0;
32+
const std::shared_ptr<TraceSampler>& response_handler) = 0;
3333

3434
// Return a JSON representation of this object's configuration. The JSON
3535
// representation is an object with the following properties:

include/datadog/datadog_agent_config.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ struct DatadogAgentConfig {
6666
// How often, in seconds, to query the Datadog Agent for remote configuration
6767
// updates.
6868
Optional<double> remote_configuration_poll_interval_seconds;
69-
// Whether APM tracing is enabled. This affects whether the
70-
// "Datadog-Client-Computed-Stats: yes" header is sent with trace requests.
71-
Optional<bool> apm_tracing_enabled;
7269
};
7370

7471
class FinalizedDatadogAgentConfig {
@@ -90,7 +87,6 @@ class FinalizedDatadogAgentConfig {
9087
std::chrono::steady_clock::duration shutdown_timeout;
9188
std::chrono::steady_clock::duration remote_configuration_poll_interval;
9289
std::unordered_map<ConfigName, ConfigMetadata> metadata;
93-
bool apm_tracing_enabled;
9490

9591
// Origin detection
9692
Optional<std::string> admission_controller_uid;

include/datadog/null_collector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace tracing {
1111
class NullCollector : public Collector {
1212
public:
1313
Expected<void> send(std::vector<std::unique_ptr<SpanData>>&&,
14-
const std::shared_ptr<ErasedTraceSampler>&) override {
14+
const std::shared_ptr<TraceSampler>&) override {
1515
return {};
1616
}
1717

include/datadog/trace_segment.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ class Logger;
5353
struct SpanData;
5454
struct SpanDefaults;
5555
class SpanSampler;
56-
class ErasedTraceSampler;
56+
class TraceSampler;
5757
class ConfigManager;
5858

5959
class TraceSegment {
6060
mutable std::mutex mutex_;
6161

6262
std::shared_ptr<Logger> logger_;
6363
std::shared_ptr<Collector> collector_;
64-
std::shared_ptr<ErasedTraceSampler> trace_sampler_;
65-
bool apm_tracing_enabled_;
64+
std::shared_ptr<TraceSampler> trace_sampler_;
6665
std::shared_ptr<SpanSampler> span_sampler_;
6766

6867
std::shared_ptr<const SpanDefaults> defaults_;
@@ -84,8 +83,7 @@ class TraceSegment {
8483
public:
8584
TraceSegment(const std::shared_ptr<Logger>& logger,
8685
const std::shared_ptr<Collector>& collector,
87-
std::shared_ptr<ErasedTraceSampler> trace_sampler,
88-
bool apm_tracing_enabled,
86+
const std::shared_ptr<TraceSampler>& trace_sampler,
8987
const std::shared_ptr<SpanSampler>& span_sampler,
9088
const std::shared_ptr<const SpanDefaults>& defaults,
9189
const std::shared_ptr<ConfigManager>& config_manager,

include/datadog/tracer.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace tracing {
2929
class ConfigManager;
3030
class DictReader;
3131
struct SpanConfig;
32-
class ErasedTraceSampler;
32+
class TraceSampler;
3333
class SpanSampler;
3434
class IDGenerator;
3535
class InMemoryFile;
@@ -39,8 +39,6 @@ class Tracer {
3939
RuntimeID runtime_id_;
4040
TracerSignature signature_;
4141
std::shared_ptr<ConfigManager> config_manager_;
42-
std::shared_ptr<ErasedTraceSampler>
43-
apm_tracing_disabled_sampler_; // empty if enabled
4442
std::shared_ptr<Collector> collector_;
4543
std::shared_ptr<SpanSampler> span_sampler_;
4644
std::shared_ptr<const IDGenerator> generator_;
@@ -106,10 +104,6 @@ class Tracer {
106104
// same JSON object that was logged when this Tracer was created.
107105
std::string config() const;
108106

109-
bool is_apm_tracing_enabled() const {
110-
return apm_tracing_disabled_sampler_ == nullptr;
111-
}
112-
113107
private:
114108
void store_config();
115109
};

include/datadog/tracer_config.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class Collector;
2828
class Logger;
2929
class SpanSampler;
3030
class TraceSampler;
31-
class ErasedTraceSampler;
3231

3332
struct TracerConfig {
3433
// Set the service name.
@@ -81,16 +80,6 @@ struct TracerConfig {
8180
// `telemetry/configuration.h` By default, the telemetry module is enabled.
8281
telemetry::Configuration telemetry;
8382

84-
// `apm_tracing_enabled` indicates whether APM traces and APM trace metrics
85-
// are enabled. If `false`, APM-specific traces are dropped and APM trace
86-
// metrics are not computed. This allows other products (e.g., AppSec) to
87-
// operate independently.
88-
// This is distinct from `report_traces`, which controls whether any traces
89-
// are sent at all.
90-
// `apm_tracing_enabled` is overridden by the `DD_APM_TRACING_ENABLED`
91-
// environment variable. Defaults to `true`.
92-
Optional<bool> apm_tracing_enabled;
93-
9483
// `trace_sampler` configures trace sampling. Trace sampling determines which
9584
// traces are sent to Datadog. See `trace_sampler_config.h`.
9685
TraceSamplerConfig trace_sampler;
@@ -179,6 +168,9 @@ struct TracerConfig {
179168
/// By default, it uses `ThreadedEventScheduler`, which runs tasks on a
180169
/// separate thread.
181170
std::shared_ptr<EventScheduler> event_scheduler;
171+
172+
/// TBD
173+
Optional<bool> apm_tracing_enabled;
182174
};
183175

184176
// `FinalizedTracerConfig` contains `Tracer` implementation details derived from
@@ -208,7 +200,6 @@ class FinalizedTracerConfig final {
208200
std::shared_ptr<Logger> logger;
209201
bool log_on_startup;
210202
bool generate_128bit_trace_ids;
211-
bool apm_tracing_enabled;
212203
Optional<RuntimeID> runtime_id;
213204
Clock clock;
214205
std::string integration_name;
@@ -219,6 +210,7 @@ class FinalizedTracerConfig final {
219210
HTTPClient::URL agent_url;
220211
std::shared_ptr<EventScheduler> event_scheduler;
221212
std::shared_ptr<HTTPClient> http_client;
213+
bool apm_tracing_enabled;
222214
};
223215

224216
// Return a `FinalizedTracerConfig` from the specified `config` and from any

src/datadog/config_manager.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ ConfigManager::ConfigManager(const FinalizedTracerConfig& config)
130130
default_metadata_(config.metadata),
131131
trace_sampler_(
132132
std::make_shared<TraceSampler>(config.trace_sampler, clock_)),
133-
erased_trace_sampler_(
134-
std::make_shared<ErasedTraceSampler>(trace_sampler_)),
135133
rules_(config.trace_sampler.rules),
136134
span_defaults_(std::make_shared<SpanDefaults>(config.defaults)),
137135
report_traces_(config.report_traces) {}
@@ -165,9 +163,9 @@ void ConfigManager::on_revert(const Configuration&) {
165163
telemetry::capture_configuration_change(config_metadata);
166164
}
167165

168-
std::shared_ptr<ErasedTraceSampler> ConfigManager::trace_sampler() {
166+
std::shared_ptr<TraceSampler> ConfigManager::trace_sampler() {
169167
std::lock_guard<std::mutex> lock(mutex_);
170-
return erased_trace_sampler_;
168+
return trace_sampler_;
171169
}
172170

173171
std::shared_ptr<const SpanDefaults> ConfigManager::span_defaults() {

src/datadog/config_manager.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ class ConfigManager : public remote_config::Listener {
7070
std::unordered_map<ConfigName, ConfigMetadata> default_metadata_;
7171

7272
std::shared_ptr<TraceSampler> trace_sampler_;
73-
// wraps trace_sampler_ and should be changed if trace_sampler_ is changed
74-
// Could be created every time, but that would be a waste
75-
std::shared_ptr<ErasedTraceSampler> erased_trace_sampler_;
7673
std::vector<TraceSamplerRule> rules_;
7774

7875
DynamicConfig<std::shared_ptr<const SpanDefaults>> span_defaults_;
@@ -96,7 +93,7 @@ class ConfigManager : public remote_config::Listener {
9693
void on_post_process() override{};
9794

9895
// Return the `TraceSampler` consistent with the most recent configuration.
99-
std::shared_ptr<ErasedTraceSampler> trace_sampler();
96+
std::shared_ptr<TraceSampler> trace_sampler();
10097

10198
// Return the `SpanDefaults` consistent with the most recent configuration.
10299
std::shared_ptr<const SpanDefaults> span_defaults();

src/datadog/datadog_agent.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ DatadogAgent::DatadogAgent(
157157
flush_interval_(config.flush_interval),
158158
request_timeout_(config.request_timeout),
159159
shutdown_timeout_(config.shutdown_timeout),
160-
remote_config_(tracer_signature, rc_listeners, logger),
161-
apm_tracing_enabled_(config.apm_tracing_enabled) {
160+
remote_config_(tracer_signature, rc_listeners, logger) {
162161
assert(logger_);
163162

164163
// Set HTTP headers
@@ -212,7 +211,7 @@ DatadogAgent::~DatadogAgent() {
212211

213212
Expected<void> DatadogAgent::send(
214213
std::vector<std::unique_ptr<SpanData>>&& spans,
215-
const std::shared_ptr<ErasedTraceSampler>& response_handler) {
214+
const std::shared_ptr<TraceSampler>& response_handler) {
216215
std::lock_guard<std::mutex> lock(mutex_);
217216
trace_chunks_.push_back(TraceChunk{std::move(spans), response_handler});
218217
return nullopt;
@@ -273,7 +272,7 @@ void DatadogAgent::flush() {
273272
// One HTTP request to the Agent could possibly involve trace chunks from
274273
// multiple tracers, and thus multiple trace samplers might need to have
275274
// their rates updated. Unlikely, but possible.
276-
std::unordered_set<std::shared_ptr<ErasedTraceSampler>> response_handlers;
275+
std::unordered_set<std::shared_ptr<TraceSampler>> response_handlers;
277276
for (auto& chunk : trace_chunks) {
278277
response_handlers.insert(std::move(chunk.response_handler));
279278
}
@@ -285,9 +284,6 @@ void DatadogAgent::flush() {
285284
for (const auto& [key, value] : headers_) {
286285
writer.set(key, value);
287286
}
288-
if (!apm_tracing_enabled_) {
289-
writer.set("Datadog-Client-Computed-Stats", "yes");
290-
}
291287
};
292288

293289
// This is the callback for the HTTP response. It's invoked

src/datadog/datadog_agent.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
namespace datadog {
2222
namespace tracing {
2323

24-
class ErasedTraceSampler;
2524
class FinalizedDatadogAgentConfig;
2625
class Logger;
2726
struct SpanData;
27+
class TraceSampler;
2828
struct TracerSignature;
2929

3030
class DatadogAgent : public Collector {
3131
public:
3232
struct TraceChunk {
3333
std::vector<std::unique_ptr<SpanData>> spans;
34-
std::shared_ptr<ErasedTraceSampler> response_handler;
34+
std::shared_ptr<TraceSampler> response_handler;
3535
};
3636

3737
private:
@@ -51,7 +51,6 @@ class DatadogAgent : public Collector {
5151
remote_config::Manager remote_config_;
5252

5353
std::unordered_map<std::string, std::string> headers_;
54-
bool apm_tracing_enabled_;
5554

5655
void flush();
5756

@@ -64,7 +63,7 @@ class DatadogAgent : public Collector {
6463

6564
Expected<void> send(
6665
std::vector<std::unique_ptr<SpanData>>&& spans,
67-
const std::shared_ptr<ErasedTraceSampler>& response_handler) override;
66+
const std::shared_ptr<TraceSampler>& response_handler) override;
6867

6968
void get_and_apply_remote_configuration_updates();
7069

0 commit comments

Comments
 (0)