Skip to content

Commit

Permalink
Remove unnecessary semicolon in ETW exporter (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Oct 16, 2021
1 parent f030127 commit 096c08b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Logger : public logs::Logger
{
static ETWProvider instance; // C++11 magic static
return instance;
};
}

/**
* @brief Init a reference to etw::ProviderHandle
Expand Down
47 changes: 25 additions & 22 deletions exporters/etw/include/opentelemetry/exporters/etw/etw_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class PropertyValue : public PropertyVariant
static std::vector<T> to_vector(const nostd::span<const T, nostd::dynamic_extent> &source)
{
return std::vector<T>(source.begin(), source.end());
};
}

/**
* @brief Convert span<string_view> to vector<string>
Expand All @@ -98,7 +98,7 @@ class PropertyValue : public PropertyVariant
result.push_back(std::string(item.data()));
}
return result;
};
}

/**
* @brief Convert vector<INTEGRAL> to span<INTEGRAL>.
Expand All @@ -111,7 +111,7 @@ class PropertyValue : public PropertyVariant
{
nostd::span<const T> result(vec.data(), vec.size());
return result;
};
}

/**
* @brief Convert vector<FLOAT> to span<const FLOAT>.
Expand All @@ -124,69 +124,72 @@ class PropertyValue : public PropertyVariant
{
nostd::span<const T> result(vec.data(), vec.size());
return result;
};
}

public:
/**
* @brief PropertyValue from bool
* @param v
* @return
*/
PropertyValue(bool value) : PropertyVariant(value){};
PropertyValue(bool value) : PropertyVariant(value) {}

/**
* @brief PropertyValue from integral.
* @param v
* @return
*/
template <typename TInteger, std::enable_if_t<std::is_integral<TInteger>::value, bool> = true>
PropertyValue(TInteger number) : PropertyVariant(number){};
PropertyValue(TInteger number) : PropertyVariant(number)
{}

/**
* @brief PropertyValue from floating point.
* @param v
* @return
*/
template <typename TFloat, std::enable_if_t<std::is_floating_point<TFloat>::value, bool> = true>
PropertyValue(TFloat number) : PropertyVariant(double(number)){};
PropertyValue(TFloat number) : PropertyVariant(double(number))
{}

/**
* @brief Default PropertyValue (int32_t=0)
* @param v
* @return
*/
PropertyValue() : PropertyVariant(int32_t(0)){};
PropertyValue() : PropertyVariant(int32_t(0)) {}

/**
* @brief PropertyValue from array of characters as string.
*
* @param v
* @return
*/
PropertyValue(char value[]) : PropertyVariant(std::string(value)){};
PropertyValue(char value[]) : PropertyVariant(std::string(value)) {}

/**
* @brief PropertyValue from array of characters as string.
*
* @param v
* @return
*/
PropertyValue(const char *value) : PropertyVariant(std::string(value)){};
PropertyValue(const char *value) : PropertyVariant(std::string(value)) {}

/**
* @brief PropertyValue from string.
*
* @param v
* @return
*/
PropertyValue(const std::string &value) : PropertyVariant(value){};
PropertyValue(const std::string &value) : PropertyVariant(value) {}

/**
* @brief PropertyValue from vector as array.
* @return
*/
template <typename T>
PropertyValue(std::vector<T> value) : PropertyVariant(value){};
PropertyValue(std::vector<T> value) : PropertyVariant(value)
{}

/**
* @brief Convert owning PropertyValue to non-owning common::AttributeValue
Expand Down Expand Up @@ -217,11 +220,11 @@ class PropertyValue : public PropertyVariant
case common::AttributeType::kTypeCString: {
PropertyVariant::operator=(nostd::get<const char *>(v));
break;
};
}
case common::AttributeType::kTypeString: {
PropertyVariant::operator=(nostd::string_view(nostd::get<nostd::string_view>(v)).data());
break;
};
}

case common::AttributeType::kTypeSpanByte:
PropertyVariant::operator=(to_vector(nostd::get<nostd::span<const uint8_t>>(v)));
Expand Down Expand Up @@ -361,15 +364,15 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap
/**
* @brief PropertyValueMap constructor.
*/
Properties() : PropertyValueMap(){};
Properties() : PropertyValueMap() {}

/**
* @brief PropertyValueMap constructor from initializer list.
*/
Properties(const std::initializer_list<PropertyValueType> properties) : PropertyValueMap()
{
(*this) = (properties);
};
}

/**
* @brief PropertyValueMap assignment operator from initializer list.
Expand All @@ -378,12 +381,12 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap
{
PropertyValueMap::operator=(properties);
return (*this);
};
}

/**
* @brief PropertyValueMap constructor from map.
*/
Properties(const PropertyValueMap &properties) : PropertyValueMap() { (*this) = properties; };
Properties(const PropertyValueMap &properties) : PropertyValueMap() { (*this) = properties; }

/**
* @brief PropertyValueMap assignment operator from map.
Expand All @@ -392,7 +395,7 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap
{
PropertyValueMap::operator=(properties);
return (*this);
};
}

/**
* @brief PropertyValueMap constructor from KeyValueIterable
Expand All @@ -414,7 +417,7 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap
return true;
});
return (*this);
};
}

/**
* @brief PropertyValueMap property accessor.
Expand All @@ -439,12 +442,12 @@ class Properties : public common::KeyValueIterable, public PropertyValueMap
}
}
return true;
};
}

/**
* @return the number of key-value pairs
*/
size_t size() const noexcept override { return PropertyValueMap::size(); };
size_t size() const noexcept override { return PropertyValueMap::size(); }
};

} // namespace etw
Expand Down
28 changes: 14 additions & 14 deletions exporters/etw/include/opentelemetry/exporters/etw/etw_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ class ETWProvider
{
data.refCount = 1;
data.providerHandle = hProvider;
};
};
}
}
break;

#ifdef HAVE_MSGPACK
Expand All @@ -180,7 +180,7 @@ class ETWProvider
data.refCount = 1;
data.providerHandle = hProvider;
}
};
}
break;
#endif

Expand Down Expand Up @@ -232,7 +232,7 @@ class ETWProvider
}
return result;
}
};
}
return STATUS_ERROR;
}

Expand All @@ -248,7 +248,7 @@ class ETWProvider
{
// Provider not registered!
return STATUS_ERROR;
};
}

std::string eventName = "NoName";
auto nameField = eventData[ETW_FIELD_NAME];
Expand Down Expand Up @@ -361,7 +361,7 @@ class ETWProvider
// TODO: unsupported type
break;
}
};
}

std::vector<uint8_t> v = nlohmann::json::to_msgpack(jObj);

Expand All @@ -385,7 +385,7 @@ class ETWProvider
else
{
writeResponse = EventWrite(providerData.providerHandle, &evtDescriptor, 1, evtData);
};
}

switch (writeResponse)
{
Expand All @@ -401,12 +401,12 @@ class ETWProvider
break;
default:
break;
};
}

if (writeResponse == ERROR_ARITHMETIC_OVERFLOW)
{
return STATUS_EFBIG;
};
}
return (unsigned long)(writeResponse);
#else
UNREFERENCED_PARAMETER(providerData);
Expand Down Expand Up @@ -435,7 +435,7 @@ class ETWProvider
{
// Provider not registered!
return STATUS_ERROR;
};
}

UINT32 eventTags = MICROSOFT_EVENTTAG_NORMAL_PERSISTENCE;

Expand Down Expand Up @@ -539,7 +539,7 @@ class ETWProvider
// TODO: unsupported type
break;
}
};
}

if (!builder.End()) // Returns false if the metadata is too large.
{
Expand Down Expand Up @@ -572,7 +572,7 @@ class ETWProvider
if (writeResponse == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW))
{
return STATUS_EFBIG;
};
}

return (unsigned long)(writeResponse);
}
Expand All @@ -598,7 +598,7 @@ class ETWProvider
return STATUS_ERROR;
}
return STATUS_ERROR;
};
}

static const REGHANDLE INVALID_HANDLE = _UI64_MAX;

Expand All @@ -615,7 +615,7 @@ class ETWProvider
{
static std::map<std::string, Handle> providers;
return providers;
};
}
};

OPENTELEMETRY_END_NAMESPACE
Expand Down
Loading

0 comments on commit 096c08b

Please sign in to comment.