Skip to content

Commit d91e5ba

Browse files
authored
[BUILD] Use fully qualified references to trace/common namespace (#2424)
1 parent 39ad238 commit d91e5ba

17 files changed

Lines changed: 116 additions & 103 deletions

File tree

api/include/opentelemetry/trace/span_context_kv_iterable_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace trace
2424
namespace detail
2525
{
2626
template <class T>
27-
inline void take_span_context_kv(SpanContext, common::KeyValueIterableView<T>)
27+
inline void take_span_context_kv(SpanContext, opentelemetry::common::KeyValueIterableView<T>)
2828
{}
2929

3030
template <class T, nostd::enable_if_t<common::detail::is_key_value_iterable<T>::value> * = nullptr>

exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class Logger : public opentelemetry::logs::Logger
229229
opentelemetry::trace::TraceId trace_id,
230230
opentelemetry::trace::SpanId span_id,
231231
opentelemetry::trace::TraceFlags trace_flags,
232-
common::SystemTimestamp timestamp) noexcept
232+
opentelemetry::common::SystemTimestamp timestamp) noexcept
233233
{
234234
UNREFERENCED_PARAMETER(trace_flags);
235235

@@ -358,11 +358,12 @@ class LoggerProvider : public opentelemetry::logs::LoggerProvider
358358
}
359359

360360
nostd::shared_ptr<opentelemetry::logs::Logger> GetLogger(
361-
nostd::string_view logger_name,
362-
nostd::string_view library_name,
363-
nostd::string_view version = "",
364-
nostd::string_view schema_url = "",
365-
const common::KeyValueIterable &attributes = common::NoopKeyValueIterable()) override
361+
opentelemetry::nostd::string_view logger_name,
362+
opentelemetry::nostd::string_view library_name,
363+
opentelemetry::nostd::string_view version = "",
364+
opentelemetry::nostd::string_view schema_url = "",
365+
const opentelemetry::common::KeyValueIterable &attributes =
366+
opentelemetry::common::NoopKeyValueIterable()) override
366367
{
367368
UNREFERENCED_PARAMETER(library_name);
368369
UNREFERENCED_PARAMETER(version);

exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -195,67 +195,67 @@ class PropertyValue : public PropertyVariant
195195
* @brief Convert non-owning common::AttributeValue to owning PropertyValue.
196196
* @return
197197
*/
198-
PropertyValue &FromAttributeValue(const common::AttributeValue &v)
198+
PropertyValue &FromAttributeValue(const opentelemetry::common::AttributeValue &v)
199199
{
200200
switch (v.index())
201201
{
202-
case common::AttributeType::kTypeBool:
202+
case opentelemetry::common::AttributeType::kTypeBool:
203203
PropertyVariant::operator=(nostd::get<bool>(v));
204204
break;
205-
case common::AttributeType::kTypeInt:
205+
case opentelemetry::common::AttributeType::kTypeInt:
206206
PropertyVariant::operator=(nostd::get<int32_t>(v));
207207
break;
208-
case common::AttributeType::kTypeInt64:
208+
case opentelemetry::common::AttributeType::kTypeInt64:
209209
PropertyVariant::operator=(nostd::get<int64_t>(v));
210210
break;
211-
case common::AttributeType::kTypeUInt:
211+
case opentelemetry::common::AttributeType::kTypeUInt:
212212
PropertyVariant::operator=(nostd::get<uint32_t>(v));
213213
break;
214-
case common::AttributeType::kTypeUInt64:
214+
case opentelemetry::common::AttributeType::kTypeUInt64:
215215
PropertyVariant::operator=(nostd::get<uint64_t>(v));
216216
break;
217-
case common::AttributeType::kTypeDouble:
217+
case opentelemetry::common::AttributeType::kTypeDouble:
218218
PropertyVariant::operator=(nostd::get<double>(v));
219219
break;
220-
case common::AttributeType::kTypeCString: {
220+
case opentelemetry::common::AttributeType::kTypeCString: {
221221
PropertyVariant::operator=(nostd::get<const char *>(v));
222222
break;
223223
}
224-
case common::AttributeType::kTypeString: {
224+
case opentelemetry::common::AttributeType::kTypeString: {
225225
PropertyVariant::operator=
226226
(std::string{nostd::string_view(nostd::get<nostd::string_view>(v)).data()});
227227
break;
228228
}
229229

230-
case common::AttributeType::kTypeSpanByte:
230+
case opentelemetry::common::AttributeType::kTypeSpanByte:
231231
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const uint8_t>>(v)));
232232
break;
233233

234-
case common::AttributeType::kTypeSpanBool:
234+
case opentelemetry::common::AttributeType::kTypeSpanBool:
235235
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const bool>>(v)));
236236
break;
237237

238-
case common::AttributeType::kTypeSpanInt:
238+
case opentelemetry::common::AttributeType::kTypeSpanInt:
239239
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const int32_t>>(v)));
240240
break;
241241

242-
case common::AttributeType::kTypeSpanInt64:
242+
case opentelemetry::common::AttributeType::kTypeSpanInt64:
243243
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const int64_t>>(v)));
244244
break;
245245

246-
case common::AttributeType::kTypeSpanUInt:
246+
case opentelemetry::common::AttributeType::kTypeSpanUInt:
247247
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const uint32_t>>(v)));
248248
break;
249249

250-
case common::AttributeType::kTypeSpanUInt64:
250+
case opentelemetry::common::AttributeType::kTypeSpanUInt64:
251251
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const uint64_t>>(v)));
252252
break;
253253

254-
case common::AttributeType::kTypeSpanDouble:
254+
case opentelemetry::common::AttributeType::kTypeSpanDouble:
255255
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const double>>(v)));
256256
break;
257257

258-
case common::AttributeType::kTypeSpanString:
258+
case opentelemetry::common::AttributeType::kTypeSpanString:
259259
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const nostd::string_view>>(v)));
260260
break;
261261

@@ -269,9 +269,9 @@ class PropertyValue : public PropertyVariant
269269
* @brief Convert owning PropertyValue to non-owning common::AttributeValue
270270
* @param other
271271
*/
272-
common::AttributeValue ToAttributeValue() const
272+
opentelemetry::common::AttributeValue ToAttributeValue() const
273273
{
274-
common::AttributeValue value;
274+
opentelemetry::common::AttributeValue value;
275275

276276
switch (this->index())
277277
{
@@ -353,7 +353,7 @@ using PropertyValueMap = std::map<std::string, PropertyValue>;
353353
/**
354354
* @brief Map of PropertyValue with common::KeyValueIterable interface.
355355
*/
356-
class Properties : public common::KeyValueIterable, public PropertyValueMap
356+
class Properties : public opentelemetry::common::KeyValueIterable, public PropertyValueMap
357357
{
358358

359359
/**
@@ -404,19 +404,20 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap
404404
* container.
405405
*
406406
*/
407-
Properties(const common::KeyValueIterable &other) { (*this) = other; }
407+
Properties(const opentelemetry::common::KeyValueIterable &other) { (*this) = other; }
408408

409409
/**
410410
* @brief PropertyValueMap assignment operator.
411411
*/
412-
Properties &operator=(const common::KeyValueIterable &other)
412+
Properties &operator=(const opentelemetry::common::KeyValueIterable &other)
413413
{
414414
clear();
415-
other.ForEachKeyValue([&](nostd::string_view key, common::AttributeValue value) noexcept {
416-
std::string k(key.data(), key.length());
417-
(*this)[k].FromAttributeValue(value);
418-
return true;
419-
});
415+
other.ForEachKeyValue(
416+
[&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept {
417+
std::string k(key.data(), key.length());
418+
(*this)[k].FromAttributeValue(value);
419+
return true;
420+
});
420421
return (*this);
421422
}
422423

@@ -431,12 +432,13 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap
431432
* the iteration is aborted.
432433
* @return true if every key-value pair was iterated over
433434
*/
434-
bool ForEachKeyValue(nostd::function_ref<bool(nostd::string_view, common::AttributeValue)>
435-
callback) const noexcept override
435+
bool ForEachKeyValue(
436+
nostd::function_ref<bool(nostd::string_view, opentelemetry::common::AttributeValue)> callback)
437+
const noexcept override
436438
{
437439
for (const auto &kv : (*this))
438440
{
439-
const common::AttributeValue &value = kv.second.ToAttributeValue();
441+
const opentelemetry::common::AttributeValue &value = kv.second.ToAttributeValue();
440442
if (!callback(nostd::string_view{kv.first}, value))
441443
{
442444
return false;

exporters/etw/include/opentelemetry/exporters/etw/etw_provider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class ETWProvider
344344
}
345345
# if HAVE_TYPE_GUID
346346
// TODO: consider adding UUID/GUID to spec
347-
case common::AttributeType::TYPE_GUID: {
347+
case opentelemetry::common::AttributeType::TYPE_GUID: {
348348
auto temp = nostd::get<GUID>(value);
349349
// TODO: add transform from GUID type to string?
350350
jObj[name] = temp;

exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ std::string GetName(T &t)
107107
* @return Span Start timestamp
108108
*/
109109
template <class T>
110-
common::SystemTimestamp GetStartTime(T &t)
110+
opentelemetry::common::SystemTimestamp GetStartTime(T &t)
111111
{
112112
return t.GetStartTime();
113113
}
@@ -119,7 +119,7 @@ common::SystemTimestamp GetStartTime(T &t)
119119
* @return Span Stop timestamp
120120
*/
121121
template <class T>
122-
common::SystemTimestamp GetEndTime(T &t)
122+
opentelemetry::common::SystemTimestamp GetEndTime(T &t)
123123
{
124124
return t.GetEndTime();
125125
}
@@ -161,7 +161,7 @@ void UpdateStatus(T &t, Properties &props)
161161
*/
162162

163163
class Tracer : public opentelemetry::trace::Tracer,
164-
public std::enable_shared_from_this<trace::Tracer>
164+
public std::enable_shared_from_this<opentelemetry::trace::Tracer>
165165
{
166166

167167
/**
@@ -214,16 +214,16 @@ class Tracer : public opentelemetry::trace::Tracer,
214214
{
215215
size_t idx = 0;
216216
std::string linksValue;
217-
links.ForEachKeyValue(
218-
[&](opentelemetry::trace::SpanContext ctx, const common::KeyValueIterable &) {
219-
if (!linksValue.empty())
220-
{
221-
linksValue += ',';
222-
linksValue += ToLowerBase16(ctx.span_id());
223-
}
224-
idx++;
225-
return true;
226-
});
217+
links.ForEachKeyValue([&](opentelemetry::trace::SpanContext ctx,
218+
const opentelemetry::common::KeyValueIterable &) {
219+
if (!linksValue.empty())
220+
{
221+
linksValue += ',';
222+
linksValue += ToLowerBase16(ctx.span_id());
223+
}
224+
idx++;
225+
return true;
226+
});
227227
attributes[ETW_FIELD_SPAN_LINKS] = linksValue;
228228
}
229229
}
@@ -414,7 +414,7 @@ class Tracer : public opentelemetry::trace::Tracer,
414414
*/
415415
nostd::shared_ptr<opentelemetry::trace::Span> StartSpan(
416416
nostd::string_view name,
417-
const common::KeyValueIterable &attributes,
417+
const opentelemetry::common::KeyValueIterable &attributes,
418418
const opentelemetry::trace::SpanContextKeyValueIterable &links,
419419
const opentelemetry::trace::StartSpanOptions &options = {}) noexcept override
420420
{
@@ -425,8 +425,9 @@ class Tracer : public opentelemetry::trace::Tracer,
425425
Properties evtCopy = attributes;
426426
return StartSpan(name, evtCopy, links, options);
427427
#else // OPENTELEMETRY_RTTI_ENABLED is defined
428-
common::KeyValueIterable &attribs = const_cast<common::KeyValueIterable &>(attributes);
429-
Properties *evt = dynamic_cast<Properties *>(&attribs);
428+
opentelemetry::common::KeyValueIterable &attribs =
429+
const_cast<opentelemetry::common::KeyValueIterable &>(attributes);
430+
Properties *evt = dynamic_cast<Properties *>(&attribs);
430431
if (evt != nullptr)
431432
{
432433
// Pass as a reference to original modifyable collection without creating a copy
@@ -491,8 +492,9 @@ class Tracer : public opentelemetry::trace::Tracer,
491492

492493
if (sampling_result.decision == sdk::trace::Decision::DROP)
493494
{
494-
auto noopSpan = nostd::shared_ptr<trace::Span>{
495-
new (std::nothrow) trace::NoopSpan(this->shared_from_this(), std::move(spanContext))};
495+
auto noopSpan = nostd::shared_ptr<opentelemetry::trace::Span>{
496+
new (std::nothrow)
497+
opentelemetry::trace::NoopSpan(this->shared_from_this(), std::move(spanContext))};
496498
return noopSpan;
497499
}
498500

@@ -602,9 +604,9 @@ class Tracer : public opentelemetry::trace::Tracer,
602604
* @return
603605
*/
604606
void AddEvent(opentelemetry::trace::Span &span,
605-
nostd::string_view name,
606-
common::SystemTimestamp timestamp,
607-
const common::KeyValueIterable &attributes) noexcept
607+
opentelemetry::nostd::string_view name,
608+
opentelemetry::common::SystemTimestamp timestamp,
609+
const opentelemetry::common::KeyValueIterable &attributes) noexcept
608610
{
609611
// If RTTI is enabled by compiler, the below code modifies the attributes object passed as arg,
610612
// which is sometime not desirable, set OPENTELEMETRY_NOT_USE_RTTI in application
@@ -614,8 +616,9 @@ class Tracer : public opentelemetry::trace::Tracer,
614616
Properties evtCopy = attributes;
615617
return AddEvent(span, name, timestamp, evtCopy);
616618
#else // OPENTELEMETRY_RTTI_ENABLED is defined
617-
common::KeyValueIterable &attribs = const_cast<common::KeyValueIterable &>(attributes);
618-
Properties *evt = dynamic_cast<Properties *>(&attribs);
619+
opentelemetry::common::KeyValueIterable &attribs =
620+
const_cast<opentelemetry::common::KeyValueIterable &>(attributes);
621+
Properties *evt = dynamic_cast<Properties *>(&attribs);
619622
if (evt != nullptr)
620623
{
621624
// Pass as a reference to original modifyable collection without creating a copy
@@ -635,8 +638,8 @@ class Tracer : public opentelemetry::trace::Tracer,
635638
* @return
636639
*/
637640
void AddEvent(opentelemetry::trace::Span &span,
638-
nostd::string_view name,
639-
common::SystemTimestamp timestamp,
641+
opentelemetry::nostd::string_view name,
642+
opentelemetry::common::SystemTimestamp timestamp,
640643
Properties &evt) noexcept
641644
{
642645
// TODO: respect originating timestamp. Do we need to reserve
@@ -693,8 +696,8 @@ class Tracer : public opentelemetry::trace::Tracer,
693696
* @return
694697
*/
695698
void AddEvent(opentelemetry::trace::Span &span,
696-
nostd::string_view name,
697-
common::SystemTimestamp timestamp) noexcept
699+
opentelemetry::nostd::string_view name,
700+
opentelemetry::common::SystemTimestamp timestamp) noexcept
698701
{
699702
AddEvent(span, name, timestamp, sdk::GetEmptyAttributes());
700703
}
@@ -728,8 +731,8 @@ class Span : public opentelemetry::trace::Span
728731
*/
729732
Properties attributes_;
730733

731-
common::SystemTimestamp start_time_;
732-
common::SystemTimestamp end_time_;
734+
opentelemetry::common::SystemTimestamp start_time_;
735+
opentelemetry::common::SystemTimestamp end_time_;
733736

734737
opentelemetry::trace::StatusCode status_code_{opentelemetry::trace::StatusCode::kUnset};
735738
std::string status_description_;
@@ -794,13 +797,13 @@ class Span : public opentelemetry::trace::Span
794797
* @brief Get start time of this Span.
795798
* @return
796799
*/
797-
common::SystemTimestamp GetStartTime() { return start_time_; }
800+
opentelemetry::common::SystemTimestamp GetStartTime() { return start_time_; }
798801

799802
/**
800803
* @brief Get end time of this Span.
801804
* @return
802805
*/
803-
common::SystemTimestamp GetEndTime() { return end_time_; }
806+
opentelemetry::common::SystemTimestamp GetEndTime() { return end_time_; }
804807

805808
/**
806809
* @brief Get Span Name.
@@ -849,7 +852,8 @@ class Span : public opentelemetry::trace::Span
849852
* @param timestamp
850853
* @return
851854
*/
852-
void AddEvent(nostd::string_view name, common::SystemTimestamp timestamp) noexcept override
855+
void AddEvent(nostd::string_view name,
856+
opentelemetry::common::SystemTimestamp timestamp) noexcept override
853857
{
854858
owner_.AddEvent(*this, name, timestamp);
855859
}
@@ -861,9 +865,9 @@ class Span : public opentelemetry::trace::Span
861865
* @param attributes Event attributes.
862866
* @return
863867
*/
864-
void AddEvent(nostd::string_view name,
865-
common::SystemTimestamp timestamp,
866-
const common::KeyValueIterable &attributes) noexcept override
868+
void AddEvent(opentelemetry::nostd::string_view name,
869+
opentelemetry::common::SystemTimestamp timestamp,
870+
const opentelemetry::common::KeyValueIterable &attributes) noexcept override
867871
{
868872
owner_.AddEvent(*this, name, timestamp, attributes);
869873
}
@@ -901,7 +905,8 @@ class Span : public opentelemetry::trace::Span
901905
* @param value
902906
* @return
903907
*/
904-
void SetAttribute(nostd::string_view key, const common::AttributeValue &value) noexcept override
908+
void SetAttribute(nostd::string_view key,
909+
const opentelemetry::common::AttributeValue &value) noexcept override
905910
{
906911
// don't override fields propagated from span data.
907912
if (key == ETW_FIELD_NAME || key == ETW_FIELD_SPAN_ID || key == ETW_FIELD_TRACE_ID ||

0 commit comments

Comments
 (0)