Skip to content

Commit c13f728

Browse files
committed
Revert "move extract headers to its own method, this is broken"
This reverts commit 1484a48.
1 parent 1484a48 commit c13f728

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

include/datadog/tracer.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "id_generator.h"
1919
#include "optional.h"
2020
#include "span.h"
21-
#include "extraction_util.h"
2221
#include "tracer_config.h"
2322
#include "tracer_signature.h"
2423

@@ -62,9 +61,6 @@ class Tracer {
6261
Span create_span();
6362
Span create_span(const SpanConfig& config);
6463

65-
// ...
66-
Expected<ExtractedData> extract_headers(const DictReader& reader, std::unique_ptr<SpanData> span_data);
67-
6864
// Return a span whose parent and other context is parsed from the specified
6965
// `reader`, and whose attributes are determined by the optionally specified
7066
// `config`. If there is no tracing information in `reader`, then return an
@@ -73,9 +69,6 @@ class Tracer {
7369
Expected<Span> extract_span(const DictReader& reader);
7470
Expected<Span> extract_span(const DictReader& reader,
7571
const SpanConfig& config);
76-
Expected<Span> extract_span(ExtractedData& merged_context,
77-
const SpanConfig& config,
78-
std::unique_ptr<SpanData> span_data);
7972

8073
// Return a span extracted from the specified `reader` (see `extract_span`).
8174
// If there is no span to extract, then return a span that is the root of a

src/datadog/tracer.cpp

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "config_manager.h"
1717
#include "datadog_agent.h"
1818
#include "extracted_data.h"
19+
#include "extraction_util.h"
1920
#include "hex.h"
2021
#include "json.hpp"
2122
#include "platform_util.h"
@@ -142,9 +143,17 @@ Span Tracer::create_span(const SpanConfig& config) {
142143
return span;
143144
}
144145

145-
Expected<ExtractedData> Tracer::extract_headers(const DictReader& reader, std::unique_ptr<SpanData> span_data) {
146+
Expected<Span> Tracer::extract_span(const DictReader& reader) {
147+
return extract_span(reader, SpanConfig{});
148+
}
149+
150+
Expected<Span> Tracer::extract_span(const DictReader& reader,
151+
const SpanConfig& config) {
146152
assert(!extraction_styles_.empty());
153+
147154
AuditedReader audited_reader{reader};
155+
156+
auto span_data = std::make_unique<SpanData>();
148157
Optional<PropagationStyle> first_style_with_trace_id;
149158
Optional<PropagationStyle> first_style_with_parent_id;
150159
std::unordered_map<PropagationStyle, ExtractedData> extracted_contexts;
@@ -263,26 +272,6 @@ Expected<ExtractedData> Tracer::extract_headers(const DictReader& reader, std::u
263272
merged_context.headers_examined));
264273
}
265274

266-
return std::move(merged_context);
267-
}
268-
269-
Expected<Span> Tracer::extract_span(const DictReader& reader) {
270-
return extract_span(reader, SpanConfig{});
271-
}
272-
273-
Expected<Span> Tracer::extract_span(const DictReader& reader,
274-
const SpanConfig& config) {
275-
auto span_data = std::make_unique<SpanData>();
276-
auto merged_context = extract_headers(reader, std::move(span_data));
277-
if (auto* error = merged_context.if_error()) {
278-
return *error;
279-
}
280-
return extract_span(*merged_context, config, std::move(span_data));
281-
}
282-
283-
Expected<Span> Tracer::extract_span(ExtractedData& merged_context,
284-
const SpanConfig& config,
285-
std::unique_ptr<SpanData> span_data) {
286275
// We're done extracting fields. Now create the span.
287276
// This is similar to what we do in `create_span`.
288277
span_data->apply_config(*config_manager_->span_defaults(), config, clock_);

0 commit comments

Comments
 (0)