diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable.h index a29d063a92..dcbcf42129 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable.h @@ -30,7 +30,7 @@ class OtlpRecordable final : public opentelemetry::sdk::trace::Recordable const std::string GetResourceSchemaURL() const noexcept; const std::string GetInstrumentationLibrarySchemaURL() const noexcept; - proto::common::v1::InstrumentationLibrary GetProtoInstrumentationLibrary() const noexcept; + proto::common::v1::InstrumentationScope GetProtoInstrumentationScope() const noexcept; void SetIdentity(const opentelemetry::trace::SpanContext &span_context, opentelemetry::trace::SpanId parent_span_id) noexcept override; diff --git a/exporters/otlp/src/otlp_recordable.cc b/exporters/otlp/src/otlp_recordable.cc index 93281c3865..e31d773e15 100644 --- a/exporters/otlp/src/otlp_recordable.cc +++ b/exporters/otlp/src/otlp_recordable.cc @@ -62,16 +62,16 @@ const std::string OtlpRecordable::GetInstrumentationLibrarySchemaURL() const noe return schema_url; } -proto::common::v1::InstrumentationLibrary OtlpRecordable::GetProtoInstrumentationLibrary() +proto::common::v1::InstrumentationScope OtlpRecordable::GetProtoInstrumentationScope() const noexcept { - proto::common::v1::InstrumentationLibrary instrumentation_library; + proto::common::v1::InstrumentationScope instrumentation_scope; if (instrumentation_library_) { - instrumentation_library.set_name(instrumentation_library_->GetName()); - instrumentation_library.set_version(instrumentation_library_->GetVersion()); + instrumentation_scope.set_name(instrumentation_library_->GetName()); + instrumentation_scope.set_version(instrumentation_library_->GetVersion()); } - return instrumentation_library; + return instrumentation_scope; } void OtlpRecordable::SetResource(const sdk::resource::Resource &resource) noexcept diff --git a/exporters/otlp/src/otlp_recordable_utils.cc b/exporters/otlp/src/otlp_recordable_utils.cc index 427037034b..14c0dffdab 100644 --- a/exporters/otlp/src/otlp_recordable_utils.cc +++ b/exporters/otlp/src/otlp_recordable_utils.cc @@ -59,13 +59,13 @@ void OtlpRecordableUtils::PopulateRequest( for (auto &recordable : spans) { auto rec = std::unique_ptr(static_cast(recordable.release())); - auto resource_span = request->add_resource_spans(); - auto instrumentation_lib = resource_span->add_instrumentation_library_spans(); + auto resource_span = request->add_resource_spans(); + auto scope_spans = resource_span->add_scope_spans(); - *instrumentation_lib->add_spans() = std::move(rec->span()); - *instrumentation_lib->mutable_instrumentation_library() = rec->GetProtoInstrumentationLibrary(); + *scope_spans->add_spans() = std::move(rec->span()); + *scope_spans->mutable_scope() = rec->GetProtoInstrumentationScope(); - instrumentation_lib->set_schema_url(rec->GetInstrumentationLibrarySchemaURL()); + scope_spans->set_schema_url(rec->GetInstrumentationLibrarySchemaURL()); *resource_span->mutable_resource() = rec->ProtoResource(); resource_span->set_schema_url(rec->GetResourceSchemaURL()); diff --git a/exporters/otlp/test/otlp_http_exporter_test.cc b/exporters/otlp/test/otlp_http_exporter_test.cc index ef0b5a509e..d773adf788 100644 --- a/exporters/otlp/test/otlp_http_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_exporter_test.cc @@ -141,10 +141,10 @@ TEST_F(OtlpHttpExporterTestPeer, ExportJsonIntegrationTest) .WillOnce([&mock_session, report_trace_id](opentelemetry::ext::http::client::EventHandler &callback) { auto check_json = nlohmann::json::parse(mock_session->GetRequest()->body_, nullptr, false); - auto resource_span = *check_json["resource_spans"].begin(); - auto instrumentation_library_span = *resource_span["instrumentation_library_spans"].begin(); - auto span = *instrumentation_library_span["spans"].begin(); - auto received_trace_id = span["trace_id"].get(); + auto resource_span = *check_json["resource_spans"].begin(); + auto scope_span = *resource_span["scope_spans"].begin(); + auto span = *scope_span["spans"].begin(); + auto received_trace_id = span["trace_id"].get(); EXPECT_EQ(received_trace_id, report_trace_id); auto custom_header = mock_session->GetRequest()->headers_.find("Custom-Header-Key"); @@ -222,8 +222,7 @@ TEST_F(OtlpHttpExporterTestPeer, ExportBinaryIntegrationTest) opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest request_body; request_body.ParseFromArray(&mock_session->GetRequest()->body_[0], static_cast(mock_session->GetRequest()->body_.size())); - auto received_trace_id = - request_body.resource_spans(0).instrumentation_library_spans(0).spans(0).trace_id(); + auto received_trace_id = request_body.resource_spans(0).scope_spans(0).spans(0).trace_id(); EXPECT_EQ(received_trace_id, report_trace_id); auto custom_header = mock_session->GetRequest()->headers_.find("Custom-Header-Key"); diff --git a/exporters/otlp/test/otlp_recordable_test.cc b/exporters/otlp/test/otlp_recordable_test.cc index 049f3e5aeb..630c31dc2f 100644 --- a/exporters/otlp/test/otlp_recordable_test.cc +++ b/exporters/otlp/test/otlp_recordable_test.cc @@ -64,7 +64,7 @@ TEST(OtlpRecordable, SetInstrumentationLibrary) OtlpRecordable rec; auto inst_lib = trace_sdk::InstrumentationLibrary::Create("test", "v1"); rec.SetInstrumentationLibrary(*inst_lib); - auto proto_instr_libr = rec.GetProtoInstrumentationLibrary(); + auto proto_instr_libr = rec.GetProtoInstrumentationScope(); EXPECT_EQ(proto_instr_libr.name(), inst_lib->GetName()); EXPECT_EQ(proto_instr_libr.version(), inst_lib->GetVersion()); }