Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove namespace using in ETW exporter which affects global namespace #2531

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions exporters/etw/include/opentelemetry/exporters/etw/etw_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

#define MICROSOFT_EVENTTAG_NORMAL_PERSISTENCE 0x01000000

using namespace OPENTELEMETRY_NAMESPACE::exporter::etw;
namespace exporter_etw = OPENTELEMETRY_NAMESPACE::exporter::etw;

OPENTELEMETRY_BEGIN_NAMESPACE

Expand Down Expand Up @@ -237,7 +237,7 @@ class ETWProvider
}

unsigned long writeMsgPack(Handle &providerData,
Properties &eventData,
exporter_etw::Properties &eventData,
LPCGUID ActivityId = nullptr,
LPCGUID RelatedActivityId = nullptr,
uint8_t Opcode = 0)
Expand Down Expand Up @@ -268,10 +268,10 @@ class ETWProvider

switch (nameField.index())
{
case PropertyType::kTypeString:
case exporter_etw::PropertyType::kTypeString:
eventName = (char *)(nostd::get<std::string>(nameField).data()); // must be 0-terminated!
break;
case PropertyType::kTypeCString:
case exporter_etw::PropertyType::kTypeCString:
eventName = (char *)(nostd::get<const char *>(nameField));
break;
default:
Expand All @@ -298,41 +298,41 @@ class ETWProvider
auto &value = kv.second;
switch (value.index())
{
case PropertyType::kTypeBool: {
case exporter_etw::PropertyType::kTypeBool: {
UINT8 temp = static_cast<UINT8>(nostd::get<bool>(value));
jObj[name] = temp;
break;
}
case PropertyType::kTypeInt: {
case exporter_etw::PropertyType::kTypeInt: {
auto temp = nostd::get<int32_t>(value);
jObj[name] = temp;
break;
}
case PropertyType::kTypeInt64: {
case exporter_etw::PropertyType::kTypeInt64: {
auto temp = nostd::get<int64_t>(value);
jObj[name] = temp;
break;
}
case PropertyType::kTypeUInt: {
case exporter_etw::PropertyType::kTypeUInt: {
auto temp = nostd::get<uint32_t>(value);
jObj[name] = temp;
break;
}
case PropertyType::kTypeUInt64: {
case exporter_etw::PropertyType::kTypeUInt64: {
auto temp = nostd::get<uint64_t>(value);
jObj[name] = temp;
break;
}
case PropertyType::kTypeDouble: {
case exporter_etw::PropertyType::kTypeDouble: {
auto temp = nostd::get<double>(value);
jObj[name] = temp;
break;
}
case PropertyType::kTypeString: {
case exporter_etw::PropertyType::kTypeString: {
jObj[name] = nostd::get<std::string>(value);
break;
}
case PropertyType::kTypeCString: {
case exporter_etw::PropertyType::kTypeCString: {
auto temp = nostd::get<const char *>(value);
jObj[name] = temp;
break;
Expand All @@ -348,14 +348,14 @@ class ETWProvider
# endif

// TODO: arrays are not supported yet
case PropertyType::kTypeSpanByte:
case PropertyType::kTypeSpanBool:
case PropertyType::kTypeSpanInt:
case PropertyType::kTypeSpanInt64:
case PropertyType::kTypeSpanUInt:
case PropertyType::kTypeSpanUInt64:
case PropertyType::kTypeSpanDouble:
case PropertyType::kTypeSpanString:
case exporter_etw::PropertyType::kTypeSpanByte:
case exporter_etw::PropertyType::kTypeSpanBool:
case exporter_etw::PropertyType::kTypeSpanInt:
case exporter_etw::PropertyType::kTypeSpanInt64:
case exporter_etw::PropertyType::kTypeSpanUInt:
case exporter_etw::PropertyType::kTypeSpanUInt64:
case exporter_etw::PropertyType::kTypeSpanDouble:
case exporter_etw::PropertyType::kTypeSpanString:
default:
// TODO: unsupported type
break;
Expand Down Expand Up @@ -435,7 +435,7 @@ class ETWProvider
/// <param name="eventData"></param>
/// <returns></returns>
unsigned long writeTld(Handle &providerData,
Properties &eventData,
exporter_etw::Properties &eventData,
LPCGUID ActivityId = nullptr,
LPCGUID RelatedActivityId = nullptr,
uint8_t Opcode = 0 /* Information */)
Expand All @@ -459,10 +459,10 @@ class ETWProvider
auto nameField = eventData[EVENT_NAME];
switch (nameField.index())
{
case PropertyType::kTypeString:
case exporter_etw::PropertyType::kTypeString:
eventName = (char *)(nostd::get<std::string>(nameField).data());
break;
case PropertyType::kTypeCString:
case exporter_etw::PropertyType::kTypeCString:
eventName = (char *)(nostd::get<const char *>(nameField));
break;
default:
Expand All @@ -479,56 +479,56 @@ class ETWProvider
auto &value = kv.second;
switch (value.index())
{
case PropertyType::kTypeBool: {
case exporter_etw::PropertyType::kTypeBool: {
builder.AddField(name, tld::TypeBool8);
UINT8 temp = static_cast<UINT8>(nostd::get<bool>(value));
dbuilder.AddByte(temp);
break;
}
case PropertyType::kTypeInt: {
case exporter_etw::PropertyType::kTypeInt: {
builder.AddField(name, tld::TypeInt32);
auto temp = nostd::get<int32_t>(value);
dbuilder.AddValue(temp);
break;
}
case PropertyType::kTypeInt64: {
case exporter_etw::PropertyType::kTypeInt64: {
builder.AddField(name, tld::TypeInt64);
auto temp = nostd::get<int64_t>(value);
dbuilder.AddValue(temp);
break;
}
case PropertyType::kTypeUInt: {
case exporter_etw::PropertyType::kTypeUInt: {
builder.AddField(name, tld::TypeUInt32);
auto temp = nostd::get<uint32_t>(value);
dbuilder.AddValue(temp);
break;
}
case PropertyType::kTypeUInt64: {
case exporter_etw::PropertyType::kTypeUInt64: {
builder.AddField(name, tld::TypeUInt64);
auto temp = nostd::get<uint64_t>(value);
dbuilder.AddValue(temp);
break;
}
case PropertyType::kTypeDouble: {
case exporter_etw::PropertyType::kTypeDouble: {
builder.AddField(name, tld::TypeDouble);
auto temp = nostd::get<double>(value);
dbuilder.AddValue(temp);
break;
}
case PropertyType::kTypeString: {
case exporter_etw::PropertyType::kTypeString: {
builder.AddField(name, tld::TypeUtf8String);
dbuilder.AddString(nostd::get<std::string>(value).data());
break;
}
case PropertyType::kTypeCString: {
case exporter_etw::PropertyType::kTypeCString: {
builder.AddField(name, tld::TypeUtf8String);
auto temp = nostd::get<const char *>(value);
dbuilder.AddString(temp);
break;
}
#if HAVE_TYPE_GUID
// TODO: consider adding UUID/GUID to spec
case PropertyType::kGUID: {
case exporter_etw::PropertyType::kGUID: {
builder.AddField(name.c_str(), TypeGuid);
auto temp = nostd::get<GUID>(value);
dbuilder.AddBytes(&temp, sizeof(GUID));
Expand All @@ -537,14 +537,14 @@ class ETWProvider
#endif

// TODO: arrays are not supported
case PropertyType::kTypeSpanByte:
case PropertyType::kTypeSpanBool:
case PropertyType::kTypeSpanInt:
case PropertyType::kTypeSpanInt64:
case PropertyType::kTypeSpanUInt:
case PropertyType::kTypeSpanUInt64:
case PropertyType::kTypeSpanDouble:
case PropertyType::kTypeSpanString:
case exporter_etw::PropertyType::kTypeSpanByte:
case exporter_etw::PropertyType::kTypeSpanBool:
case exporter_etw::PropertyType::kTypeSpanInt:
case exporter_etw::PropertyType::kTypeSpanInt64:
case exporter_etw::PropertyType::kTypeSpanUInt:
case exporter_etw::PropertyType::kTypeSpanUInt64:
case exporter_etw::PropertyType::kTypeSpanDouble:
case exporter_etw::PropertyType::kTypeSpanString:
default:
// TODO: unsupported type
break;
Expand Down Expand Up @@ -588,7 +588,7 @@ class ETWProvider
}

unsigned long write(Handle &providerData,
Properties &eventData,
exporter_etw::Properties &eventData,
LPCGUID ActivityId,
LPCGUID RelatedActivityId,
uint8_t Opcode,
Expand Down