Skip to content

Commit

Permalink
Exports span attributes to ETW (open-telemetry#1021)
Browse files Browse the repository at this point in the history
* Exports span attributes to ETW
  • Loading branch information
ThomsonTan authored Oct 20, 2021
1 parent 55a6517 commit cc065f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,12 @@ class Span : public trace::Span
*/
void SetAttribute(nostd::string_view key, const common::AttributeValue &value) noexcept override
{
// TODO: not implemented
UNREFERENCED_PARAMETER(key);
UNREFERENCED_PARAMETER(value);
// don't override fields propagated from span data.
if (key == ETW_FIELD_NAME || key == ETW_FIELD_SPAN_ID || key == ETW_FIELD_TRACE_ID)
{
return;
}
attributes_[std::string{key}].FromAttributeValue(value);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions exporters/etw/test/etw_tracer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ TEST(ETWTracer, TracerCheck)
auto innerSpan = tracer->StartSpan("MySpanL3", attribs);
auto innerScope = tracer->WithActiveSpan(innerSpan);

// Add span attribute
EXPECT_NO_THROW(outerSpan->SetAttribute("AttrName1", "AttrValue1"));

// Add first event
std::string eventName1 = "MyEvent1";
Properties event1 =
Expand Down

0 comments on commit cc065f7

Please sign in to comment.