forked from open-telemetry/opentelemetry-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Recordable implementation for otprotocol exporter (open-telemetry#49
) * Start Recorder api * Fill out Span api * Reformat * Fill out Tracer class * Add cmake build * Add commenting * Fix formatting * Reformat * Fix date * Make mutex mutable * s/mutex_/mu_/ * Remove AddEvent with steady timestamp * Fix typo * Fill in IsRecordable * Set up protobuf dependency * Install protobuf in docker image * Merge in Recordable * Add exporter folder * Integrate protobuf files into build * Add otprotocol Recordable * Set up protobuf with bazel * Reformat * Install git in CI * Add otprotocol to cmake test * Fix typo * Fix install_protobuf.sh * Fix install_protobuf.sh * Fix install_protobuf.sh * Fix do_ci.sh * Add otprotocol windows tests * Fix typo * Make protobuf install optional for windows * Fix install_windows_protobuf.ps1 * Remove unnecessary globs * Refactor * Rearrange protobuf files * Clean up workspace * Fix formatting * Update CI * Restructure * Reformat * Refactor legacy test * Fix legacy target * Fix legacy target
- Loading branch information
Showing
30 changed files
with
1,199 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( | ||
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"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
tar zxf protobuf-cpp-${PROTOBUF_VERSION}.tar.gz --no-same-owner | ||
cd protobuf-${PROTOBUF_VERSION} | ||
./configure | ||
make && make install | ||
ldconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if(WITH_OTPROTOCOL) | ||
add_subdirectory(otlp) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "exporters/otlp", | ||
deps = [ | ||
"//sdk/src/trace", | ||
"@com_github_opentelemetry_proto//:trace_proto_cc", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "exporters/otlp/recordable.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace exporter | ||
{ | ||
namespace otlp | ||
{ | ||
void Recordable::AddEvent(nostd::string_view name, core::SystemTimestamp timestamp) noexcept | ||
{ | ||
(void)name; | ||
} | ||
|
||
void Recordable::SetStatus(trace::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 otlp | ||
} // namespace exporter | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "opentelemetry/proto/trace/v1/trace.pb.h" | ||
#include "opentelemetry/sdk/trace/recordable.h" | ||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace exporter | ||
{ | ||
namespace otlp | ||
{ | ||
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::CanonicalCode code, nostd::string_view description) noexcept override; | ||
|
||
void SetName(nostd::string_view name) noexcept override; | ||
|
||
private: | ||
proto::trace::v1::Span span_; | ||
}; | ||
} // namespace otlp | ||
} // namespace exporter | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.