File tree Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 3535 uses : actions/checkout@v5
3636 with :
3737 repository : " open-telemetry/opentelemetry-cpp"
38- ref : " v1.19 .0"
38+ ref : " v1.24 .0"
3939 path : " opentelemetry-cpp"
4040 submodules : " recursive"
4141 - name : setup dependencies
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ find_package(spdlog REQUIRED)
1313add_library (${this_target} src/sink.cc)
1414
1515target_compile_options (${this_target} PUBLIC
16- -Wall -Wextra -Werror - Wpedantic -fPIC
16+ -Wall -Wextra -Wpedantic -fPIC
1717)
1818
1919set_target_properties (${this_target} PROPERTIES EXPORT_NAME ${this_target} )
Original file line number Diff line number Diff line change 88## Requirements
99
1010- Current release tested only with Ubuntu 20.04.6 LTS
11- - OpenTelemetry >= v1.12 .0
11+ - OpenTelemetry >= v1.21 .0
1212- spdlog >= v1.5.0
1313
1414### Usage
Original file line number Diff line number Diff line change 66#include < opentelemetry/instrumentation/spdlog/sink.h>
77
88#include < opentelemetry/logs/provider.h>
9- #include < opentelemetry/trace/semantic_conventions.h>
9+ #include < opentelemetry/semconv/code_attributes.h>
10+ #include < opentelemetry/semconv/incubating/thread_attributes.h>
1011#include < opentelemetry/version.h>
1112
1213namespace spdlog
@@ -25,15 +26,16 @@ void OpenTelemetrySink<Mutex>::sink_it_(const spdlog::details::log_msg &msg)
2526
2627 if (log_record)
2728 {
28- using namespace opentelemetry ::trace::SemanticConventions;
29+ using namespace opentelemetry ::semconv::code;
30+ using namespace opentelemetry ::semconv::thread;
2931
3032 log_record->SetSeverity (levelToSeverity (msg.level ));
3133 log_record->SetBody (opentelemetry::nostd::string_view (msg.payload .data (), msg.payload .size ()));
3234 log_record->SetTimestamp (msg.time );
3335 if (!msg.source .empty ())
3436 {
35- log_record->SetAttribute (kCodeFilepath , msg.source .filename );
36- log_record->SetAttribute (kCodeLineno , msg.source .line );
37+ log_record->SetAttribute (kCodeFilePath , msg.source .filename );
38+ log_record->SetAttribute (kCodeLineNumber , msg.source .line );
3739 }
3840 log_record->SetAttribute (kThreadId , msg.thread_id );
3941 logger->EmitLogRecord (std::move (log_record));
Original file line number Diff line number Diff line change @@ -143,12 +143,12 @@ TEST_F(OpenTelemetrySinkTest, Log_Success)
143143 ASSERT_TRUE (timestamp.time_since_epoch () >= pre_log.time_since_epoch ());
144144 ASSERT_TRUE (timestamp.time_since_epoch () <= post_log.time_since_epoch ());
145145 }));
146- EXPECT_CALL (*logrecord_mock, SetAttribute (nostd::string_view (" code.lineno " ), _))
146+ EXPECT_CALL (*logrecord_mock, SetAttribute (nostd::string_view (" code.line.number " ), _))
147147 .WillOnce (Invoke ([](nostd::string_view, const common::AttributeValue &line_number) {
148148 ASSERT_TRUE (nostd::holds_alternative<int >(line_number));
149149 ASSERT_GE (nostd::get<int >(line_number), 0 );
150150 }));
151- EXPECT_CALL (*logrecord_mock, SetAttribute (nostd::string_view (" code.filepath " ), _))
151+ EXPECT_CALL (*logrecord_mock, SetAttribute (nostd::string_view (" code.file.path " ), _))
152152 .WillOnce (Invoke ([](nostd::string_view, const common::AttributeValue &file_name) {
153153 ASSERT_TRUE (nostd::holds_alternative<const char *>(file_name));
154154 ASSERT_TRUE (std::strstr (nostd::get<const char *>(file_name), " sink_test.cc" ) != nullptr );
You can’t perform that action at this time.
0 commit comments