-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Recordable implementation for otprotocol exporter #49
Changes from 43 commits
3503d72
79b4f1d
8bcff6e
c5e9a9e
a69206f
87170e3
4c7d2c0
320add0
1a3761e
597f0f3
0d8649f
c15286e
3c6fbb0
b0d1548
6210da0
c619e2b
84d5ccd
23c23b6
eecc683
414957f
c8fc557
b98eb9d
d2e2198
f470dd0
51f9182
d240118
427314a
5f5050c
092bd8d
a979b8e
fda73fe
366e9e0
9094a52
b3d611b
3b94521
04284e0
27e8526
1fbb06e
2f3296c
49c27fe
28c8e5b
f16dd46
6f5316c
2db1682
1d83819
f64c826
49c375f
ab62b01
336d466
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Copyright 2020, OpenTelemetry Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
|
||
proto_library( | ||
g-easy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name = "common_proto", | ||
srcs = [ | ||
"opentelemetry/proto/common/v1/common.proto", | ||
], | ||
) | ||
|
||
cc_proto_library( | ||
name = "common_proto_cc", | ||
deps = [":common_proto"], | ||
) | ||
|
||
proto_library( | ||
name = "resource_proto", | ||
srcs = [ | ||
"opentelemetry/proto/resource/v1/resource.proto", | ||
], | ||
deps = [ | ||
":common_proto", | ||
], | ||
) | ||
|
||
cc_proto_library( | ||
name = "resource_proto_cc", | ||
deps = [":resource_proto"], | ||
) | ||
|
||
proto_library( | ||
name = "trace_proto", | ||
srcs = [ | ||
"opentelemetry/proto/trace/v1/trace.proto", | ||
], | ||
deps = [ | ||
":common_proto", | ||
":resource_proto", | ||
], | ||
) | ||
|
||
cc_proto_library( | ||
name = "trace_proto_cc", | ||
deps = [":trace_proto"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
[ -z "${PROTOBUF_VERSION}" ] && export PROTOBUF_VERSION="3.11.4" | ||
|
||
cd / | ||
wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz | ||
g-easy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tar zxf protobuf-cpp-${PROTOBUF_VERSION}.tar.gz --no-same-owner | ||
cd protobuf-${PROTOBUF_VERSION} | ||
./configure | ||
make && make install | ||
ldconfig |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$ErrorActionPreference = "Stop" | ||
trap { $host.SetShouldExit(1) } | ||
|
||
cd vcpkg | ||
./vcpkg install protobuf:x64-windows |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(trace) | ||
add_subdirectory(exporter) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if(WITH_OTPROTOCOL) | ||
add_subdirectory(otprotocol) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2020, OpenTelemetry Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
cc_library( | ||
name = "recordable", | ||
srcs = [ | ||
"recordable.cc", | ||
], | ||
hdrs = [ | ||
"recordable.h", | ||
], | ||
include_prefix = "src/exporter/otprotocol", | ||
deps = [ | ||
"//sdk/src/trace", | ||
"@com_github_opentelemetry_proto//:trace_proto_cc", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
add_library(opentelemetry_exporter_otprotocol recordable.cc) | ||
target_link_libraries(opentelemetry_exporter_otprotocol | ||
$<TARGET_OBJECTS:opentelemetry_proto>) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "src/exporter/otprotocol/recordable.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should exporters live in the internal namespace? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I separated out into an exporters folder, similar to how it's done for go and java. |
||
namespace sdk | ||
{ | ||
namespace exporter | ||
{ | ||
namespace otprotocol | ||
{ | ||
void Recordable::AddEvent(nostd::string_view name, core::SystemTimestamp timestamp) noexcept | ||
{ | ||
(void)name; | ||
} | ||
|
||
void Recordable::SetStatus(trace_api::CanonicalCode code, nostd::string_view description) noexcept | ||
{ | ||
(void)code; | ||
(void)description; | ||
} | ||
|
||
void Recordable::SetName(nostd::string_view name) noexcept | ||
{ | ||
span_.set_name(name.data(), name.size()); | ||
} | ||
} // namespace otprotocol | ||
} // namespace exporter | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include "src/trace/recordable.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think headers needed to implement exporters should be placed in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved Recodable into the headers folder. |
||
|
||
#include "opentelemetry/proto/trace/v1/trace.pb.h" | ||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk | ||
{ | ||
namespace exporter | ||
{ | ||
namespace otprotocol | ||
{ | ||
class Recordable final : public sdk::trace::Recordable | ||
{ | ||
public: | ||
const proto::trace::v1::Span &span() const noexcept { return span_; } | ||
|
||
// sdk::trace::Recordable | ||
void AddEvent(nostd::string_view name, core::SystemTimestamp timestamp) noexcept override; | ||
|
||
void SetStatus(trace_api::CanonicalCode code, nostd::string_view description) noexcept override; | ||
|
||
void SetName(nostd::string_view name) noexcept override; | ||
|
||
private: | ||
proto::trace::v1::Span span_; | ||
}; | ||
} // namespace otprotocol | ||
} // namespace exporter | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API is gcc 4.8 compatible but SDK is not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protobuf can't work with gcc-4.8.
Maybe I should exclude just some portions of the sdk from legacy compiler tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you. Sorry to hear about protobuf.