Skip to content

Commit f6e5874

Browse files
authored
Resolve compatibility issues with OpenTelemetry C++ SDK v1.6.0 (#207)
1 parent c2bef81 commit f6e5874

File tree

7 files changed

+53
-21
lines changed

7 files changed

+53
-21
lines changed

Diff for: exporters/fluentd/CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Guideline to update the version
9+
10+
Increment the:
11+
12+
* MAJOR version when you make incompatible API/ABI changes,
13+
* MINOR version when you add functionality in a backwards compatible manner, and
14+
* PATCH version when you make backwards compatible bug fixes.
15+
16+
## [1.2.0] 2022-08-29
17+
18+
* [EXPORTER] OpenTelemetry SDK v1.6.0 compatibility
19+
20+
## [1.1.2] 2022-06-30
21+
22+
* [EXPORTER] OpenTelemetry SDK v1.4.0 compatibility
23+
24+
## [1.1.1] 2022-03-16
25+
26+
* [EXPORTER] OpenTelemetry SDK v1.1.1 compatibility
27+

Diff for: exporters/fluentd/cmake/opentelemetry-cpp.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if("${opentelemetry-cpp-tag}" STREQUAL "")
2-
set(opentelemetry-cpp-tag "96534a7c2370099ada8bd9dcdc7236c76adf47d9") # OpenTelemetry C++ v1.4.1
2+
set(opentelemetry-cpp-tag "v1.6.0")
33
endif()
44
function(target_create _target _lib)
55
add_library(${_target} STATIC IMPORTED)

Diff for: exporters/fluentd/example/fluentd-docker/fluent.conf

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
####
1212
## Source descriptions:
1313
##
14+
# Concurrent ingestion of OpenTelemetry logs and traces requires more than one system worker thread.
15+
<system>
16+
workers 3
17+
</system>
1418

1519
## built-in TCP input
1620
## @see http://docs.fluentd.org/articles/in_forward
@@ -22,10 +26,11 @@
2226
</source>
2327

2428
## built-in UNIX socket input
25-
<source>
26-
@type unix
27-
path /tmp/fluentd/log/socket.sock
28-
</source>
29+
# Uncomment for Unix Domain socket support
30+
#<source>
31+
# @type unix
32+
# path /tmp/fluentd/log/socket.sock
33+
#</source>
2934

3035
# HTTP input
3136
# POST http://localhost:8888/<tag>?json=<json>

Diff for: exporters/fluentd/include/opentelemetry/exporters/fluentd/log/recordable.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ class Recordable final : public opentelemetry::sdk::logs::Recordable {
8686
opentelemetry::common::SystemTimestamp timestamp) noexcept override;
8787

8888
/**
89-
* Set instrumentation_library for this log.
90-
* @param instrumentation_library the instrumentation library to set
89+
* Set instrumentation_scope for this log.
90+
* @param instrumentation_scope the instrumentation scope to set
9191
*/
92-
void SetInstrumentationLibrary(
93-
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
94-
&instrumentation_library) noexcept override {} // Not Supported
92+
void SetInstrumentationScope(
93+
const opentelemetry::sdk::instrumentationscope::InstrumentationScope
94+
&instrumentation_scope) noexcept override {} // Not Supported
9595

9696
nlohmann::json &Log() { return json_; }
9797

Diff for: exporters/fluentd/include/opentelemetry/exporters/fluentd/trace/recordable.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ class Recordable final : public sdk::trace::Recordable {
6767

6868
void SetDuration(std::chrono::nanoseconds duration) noexcept override;
6969

70-
void SetInstrumentationLibrary(
71-
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
72-
&instrumentation_library) noexcept override;
70+
void SetInstrumentationScope(
71+
const opentelemetry::sdk::instrumentationscope::InstrumentationScope
72+
&instrumentation_scope) noexcept override;
7373

7474
private:
7575
std::string tag_;

Diff for: exporters/fluentd/src/trace/recordable.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ void Recordable::SetSpanKind(
136136
}
137137
}
138138

139-
void Recordable::SetInstrumentationLibrary(
140-
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
141-
&instrumentation_library) noexcept {
142-
options_["tags"]["otel.library.name"] = instrumentation_library.GetName();
139+
void Recordable::SetInstrumentationScope(
140+
const opentelemetry::sdk::instrumentationscope::InstrumentationScope
141+
&instrumentation_scope) noexcept {
142+
options_["tags"]["otel.library.name"] = instrumentation_scope.GetName();
143143
options_["tags"]["otel.library.version"] =
144-
instrumentation_library.GetVersion();
144+
instrumentation_scope.GetVersion();
145145
}
146146

147147
} // namespace trace

Diff for: exporters/fluentd/test/trace/fluentd_recordable_test.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ TEST(FluentdSpanRecordable, SetDuration)
133133
EXPECT_EQ(rec.span(), j_span);
134134
}
135135

136-
TEST(FluentdSpanRecordable, SetInstrumentationLibrary)
136+
TEST(FluentdSpanRecordable, SetInstrumentationScope)
137137
{
138-
using InstrumentationLibrary = opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary;
138+
using InstrumentationScope = opentelemetry::sdk::instrumentationscope::InstrumentationScope;
139139

140140
const char *library_name = "otel-cpp";
141141
const char *library_version = "0.5.0";
142142
json j_span = {
143143
{"tags", {{"otel.library.name", library_name}, {"otel.library.version", library_version}}}};
144144
opentelemetry::exporter::fluentd::trace::Recordable rec;
145145

146-
rec.SetInstrumentationLibrary(*InstrumentationLibrary::Create(library_name, library_version));
146+
rec.SetInstrumentationScope(*InstrumentationScope::Create(library_name, library_version));
147147

148148
EXPECT_EQ(rec.span(), j_span);
149149
}

0 commit comments

Comments
 (0)