Upgrade all dependencies to new Starlark syntax. (#1483)
The update of the prometheus library requires some fixes in the test.master
parent
c370d221d0
commit
f73758e3a5
5
.bazelrc
5
.bazelrc
|
@ -21,8 +21,3 @@ build -c opt
|
||||||
# reduces build time.
|
# reduces build time.
|
||||||
build --force_pic
|
build --force_pic
|
||||||
|
|
||||||
# A number of our dependencies rely on the deprecated new_http_archive rule,
|
|
||||||
# e.g. Cares. We will have to wait for these dependencies to switch to the
|
|
||||||
# new rule befor we can remove this override.
|
|
||||||
build --incompatible_remove_native_http_archive=false
|
|
||||||
build --incompatible_remove_native_git_repository=false
|
|
||||||
|
|
|
@ -50,6 +50,10 @@ if (${BUILD_GRPC})
|
||||||
find_package(async_grpc REQUIRED)
|
find_package(async_grpc REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${BUILD_PROMETHEUS})
|
||||||
|
find_package( ZLIB REQUIRED )
|
||||||
|
endif()
|
||||||
|
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
PKG_SEARCH_MODULE(CAIRO REQUIRED cairo>=1.12.16)
|
PKG_SEARCH_MODULE(CAIRO REQUIRED cairo>=1.12.16)
|
||||||
|
@ -208,7 +212,9 @@ if(${BUILD_GRPC})
|
||||||
target_link_libraries(cartographer_grpc_server PUBLIC grpc++)
|
target_link_libraries(cartographer_grpc_server PUBLIC grpc++)
|
||||||
target_link_libraries(cartographer_grpc_server PUBLIC async_grpc)
|
target_link_libraries(cartographer_grpc_server PUBLIC async_grpc)
|
||||||
if(${BUILD_PROMETHEUS})
|
if(${BUILD_PROMETHEUS})
|
||||||
target_link_libraries(cartographer_grpc_server PUBLIC prometheus-cpp)
|
target_link_libraries(cartographer_grpc_server PUBLIC ${ZLIB_LIBRARIES})
|
||||||
|
target_link_libraries(cartographer_grpc_server PUBLIC prometheus-cpp-core)
|
||||||
|
target_link_libraries(cartographer_grpc_server PUBLIC prometheus-cpp-pull)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -265,7 +271,9 @@ if(${BUILD_GRPC})
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC async_grpc)
|
target_link_libraries(${PROJECT_NAME} PUBLIC async_grpc)
|
||||||
endif()
|
endif()
|
||||||
if(${BUILD_PROMETHEUS})
|
if(${BUILD_PROMETHEUS})
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC prometheus-cpp)
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${ZLIB_LIBRARIES})
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC prometheus-cpp-core)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC prometheus-cpp-pull)
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_PROMETHEUS=1)
|
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_PROMETHEUS=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -300,7 +308,9 @@ foreach(ABS_FIL ${ALL_TESTS})
|
||||||
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC async_grpc)
|
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC async_grpc)
|
||||||
endif()
|
endif()
|
||||||
if(${BUILD_PROMETHEUS})
|
if(${BUILD_PROMETHEUS})
|
||||||
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC prometheus-cpp)
|
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC ${ZLIB_LIBRARIES})
|
||||||
|
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC prometheus-cpp-core)
|
||||||
|
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC prometheus-cpp-pull)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC ${TEST_LIB})
|
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC ${TEST_LIB})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
@ -28,8 +28,6 @@ load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
|
||||||
|
|
||||||
grpc_deps()
|
grpc_deps()
|
||||||
|
|
||||||
load("@com_github_jupp0r_prometheus_cpp//:repositories.bzl", "load_prometheus_client_model", "load_civetweb")
|
load("@com_github_jupp0r_prometheus_cpp//:repositories.bzl", "prometheus_cpp_repositories")
|
||||||
|
|
||||||
load_prometheus_client_model()
|
prometheus_cpp_repositories()
|
||||||
|
|
||||||
load_civetweb()
|
|
||||||
|
|
|
@ -19,11 +19,11 @@ def cartographer_repositories():
|
||||||
_maybe(
|
_maybe(
|
||||||
http_archive,
|
http_archive,
|
||||||
name = "com_github_nelhage_rules_boost",
|
name = "com_github_nelhage_rules_boost",
|
||||||
sha256 = "6de4d799373e25acd66ec681fba8ffeb13e7c501091d93afa3fadd26765b0f0d",
|
sha256 = "371f49e7b29e44a718baf8b9a2dd3eca865005a851c9ecf8fb6a10a715aa58dd",
|
||||||
strip_prefix = "rules_boost-96ba810e48f4a28b85ee9c922f0b375274a97f98",
|
strip_prefix = "rules_boost-a5a95642f6097f8949020646ffe89d7243008981",
|
||||||
urls = [
|
urls = [
|
||||||
"https://mirror.bazel.build/github.com/nelhage/rules_boost/archive/96ba810e48f4a28b85ee9c922f0b375274a97f98.tar.gz",
|
"https://mirror.bazel.build/github.com/nelhage/rules_boost/archive/a5a95642f6097f8949020646ffe89d7243008981.tar.gz",
|
||||||
"https://github.com/nelhage/rules_boost/archive/96ba810e48f4a28b85ee9c922f0b375274a97f98.tar.gz",
|
"https://github.com/nelhage/rules_boost/archive/a5a95642f6097f8949020646ffe89d7243008981.tar.gz",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ def cartographer_repositories():
|
||||||
_maybe(
|
_maybe(
|
||||||
http_archive,
|
http_archive,
|
||||||
name = "net_zlib_zlib",
|
name = "net_zlib_zlib",
|
||||||
build_file = "@com_github_googlecartographer_cartographer//bazel/third_party:zlib.BUILD",
|
|
||||||
sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
|
sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
|
||||||
|
build_file = "@com_github_googlecartographer_cartographer//bazel/third_party:zlib.BUILD",
|
||||||
strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
|
strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
|
||||||
urls = [
|
urls = [
|
||||||
"https://mirror.bazel.build/github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
|
"https://mirror.bazel.build/github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
|
||||||
|
@ -229,26 +229,27 @@ def cartographer_repositories():
|
||||||
_maybe(
|
_maybe(
|
||||||
http_archive,
|
http_archive,
|
||||||
name = "com_github_grpc_grpc",
|
name = "com_github_grpc_grpc",
|
||||||
sha256 = "2fdde7d64e6fb1a397bf2aa23aeddcdcf276652d9e48270e94eb0dc94d7c1345",
|
sha256 = "e699efa9422e071a42f052ba8369fbc810e6f7c6fb0a5b1c021f54ac1a92a1f3",
|
||||||
strip_prefix = "grpc-20e7074e4101b4fdbae1764caa952301b38957c4",
|
strip_prefix = "grpc-b250f34b1225cde1bb19496c5cc5d66e40111052",
|
||||||
urls = [
|
urls = [
|
||||||
"https://mirror.bazel.build/github.com/grpc/grpc/archive/20e7074e4101b4fdbae1764caa952301b38957c4.tar.gz",
|
"https://mirror.bazel.build/github.com/grpc/grpc/archive/b250f34b1225cde1bb19496c5cc5d66e40111052.tar.gz",
|
||||||
"https://github.com/grpc/grpc/archive/20e7074e4101b4fdbae1764caa952301b38957c4.tar.gz",
|
"https://github.com/grpc/grpc/archive/b250f34b1225cde1bb19496c5cc5d66e40111052.tar.gz",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
_maybe(
|
_maybe(
|
||||||
http_archive,
|
http_archive,
|
||||||
name = "com_github_jupp0r_prometheus_cpp",
|
name = "com_github_jupp0r_prometheus_cpp",
|
||||||
sha256 = "0d3e999dfbfc49bb117698154a01dac26fb59e77d0354ccb81107a6da7b014d0",
|
sha256 = "6604ea0b5ef75f405c09218f13805d4141f6506eaf0da76f5f64625f62acfcd3",
|
||||||
strip_prefix = "prometheus-cpp-8330b3f753fb774c9e0567baaac20ffb7042723b",
|
strip_prefix = "prometheus-cpp-4e0814ee3f93b796356a51a4795a332568940a72",
|
||||||
urls = [
|
urls = [
|
||||||
"https://github.com/jupp0r/prometheus-cpp/archive/8330b3f753fb774c9e0567baaac20ffb7042723b.tar.gz",
|
"https://github.com/jupp0r/prometheus-cpp/archive/4e0814ee3f93b796356a51a4795a332568940a72.tar.gz",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
_maybe(http_archive,
|
_maybe(http_archive,
|
||||||
name = "com_github_googlecartographer_async_grpc",
|
name = "com_github_googlecartographer_async_grpc",
|
||||||
|
sha256 = "83c2a27c92979787f38810adc4b6bb67aa09607c53dbadca3430a5f29e0a1cd3",
|
||||||
strip_prefix = "async_grpc-771af45374af7f7bfc3b622ed7efbe29a4aba403",
|
strip_prefix = "async_grpc-771af45374af7f7bfc3b622ed7efbe29a4aba403",
|
||||||
urls = [
|
urls = [
|
||||||
"https://github.com/googlecartographer/async_grpc/archive/771af45374af7f7bfc3b622ed7efbe29a4aba403.tar.gz",
|
"https://github.com/googlecartographer/async_grpc/archive/771af45374af7f7bfc3b622ed7efbe29a4aba403.tar.gz",
|
||||||
|
|
|
@ -51,3 +51,8 @@ cc_library(
|
||||||
],
|
],
|
||||||
includes = ["."],
|
includes = ["."],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "z",
|
||||||
|
actual = ":zlib",
|
||||||
|
)
|
||||||
|
|
|
@ -70,7 +70,8 @@ cc_library(
|
||||||
"//cartographer",
|
"//cartographer",
|
||||||
"@com_github_googlecartographer_async_grpc//async_grpc",
|
"@com_github_googlecartographer_async_grpc//async_grpc",
|
||||||
"@com_github_grpc_grpc//:grpc++",
|
"@com_github_grpc_grpc//:grpc++",
|
||||||
"@com_github_jupp0r_prometheus_cpp//:prometheus_cpp",
|
"@com_github_jupp0r_prometheus_cpp//core",
|
||||||
|
"@com_github_jupp0r_prometheus_cpp//pull",
|
||||||
"@com_google_glog//:glog",
|
"@com_google_glog//:glog",
|
||||||
"@com_google_protobuf//:cc_wkt_protos",
|
"@com_google_protobuf//:cc_wkt_protos",
|
||||||
],
|
],
|
||||||
|
|
|
@ -38,7 +38,7 @@ TEST(LocalTrajectoryUploaderTest, HandlesInvalidUplink) {
|
||||||
mapping::proto::TrajectoryBuilderOptions options;
|
mapping::proto::TrajectoryBuilderOptions options;
|
||||||
auto status = uploader->AddTrajectory(
|
auto status = uploader->AddTrajectory(
|
||||||
kClientId, kLocalTrajectoryId, {kRangeSensorId, kImuSensorId}, options);
|
kClientId, kLocalTrajectoryId, {kRangeSensorId, kImuSensorId}, options);
|
||||||
EXPECT_EQ(status.error_code(), grpc::StatusCode::DEADLINE_EXCEEDED);
|
EXPECT_FALSE(status.ok());
|
||||||
auto sensor_data = absl::make_unique<proto::SensorData>();
|
auto sensor_data = absl::make_unique<proto::SensorData>();
|
||||||
sensor_data->mutable_sensor_metadata()->set_client_id(kClientId);
|
sensor_data->mutable_sensor_metadata()->set_client_id(kClientId);
|
||||||
sensor_data->mutable_sensor_metadata()->set_sensor_id(kImuSensorId.id);
|
sensor_data->mutable_sensor_metadata()->set_sensor_id(kImuSensorId.id);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "prometheus/exposer.h"
|
#include "prometheus/exposer.h"
|
||||||
|
#include "prometheus/metric_family.h"
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace cloud {
|
namespace cloud {
|
||||||
|
@ -28,6 +29,8 @@ namespace metrics {
|
||||||
namespace prometheus {
|
namespace prometheus {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using Label = ::prometheus::ClientMetric::Label;
|
||||||
|
|
||||||
static auto* kCounter = ::cartographer::metrics::Counter::Null();
|
static auto* kCounter = ::cartographer::metrics::Counter::Null();
|
||||||
static auto* kGauge = ::cartographer::metrics::Gauge::Null();
|
static auto* kGauge = ::cartographer::metrics::Gauge::Null();
|
||||||
static auto* kScoresMetric = ::cartographer::metrics::Histogram::Null();
|
static auto* kScoresMetric = ::cartographer::metrics::Histogram::Null();
|
||||||
|
@ -58,22 +61,20 @@ TEST(MetricsTest, CollectCounter) {
|
||||||
kCounter->Increment();
|
kCounter->Increment();
|
||||||
kCounter->Increment(5);
|
kCounter->Increment(5);
|
||||||
double expected_value = 1 + 5;
|
double expected_value = 1 + 5;
|
||||||
std::vector<::io::prometheus::client::MetricFamily> collected;
|
std::vector<::prometheus::MetricFamily> collected;
|
||||||
{
|
{
|
||||||
std::shared_ptr<::prometheus::Collectable> collectable;
|
std::shared_ptr<::prometheus::Collectable> collectable;
|
||||||
CHECK(collectable = factory.GetCollectable().lock());
|
CHECK(collectable = factory.GetCollectable().lock());
|
||||||
collected = collectable->Collect();
|
collected = collectable->Collect();
|
||||||
}
|
}
|
||||||
ASSERT_EQ(collected.size(), 1);
|
ASSERT_EQ(collected.size(), 1);
|
||||||
ASSERT_EQ(collected[0].metric_size(), 1);
|
ASSERT_EQ(collected[0].metric.size(), 1);
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
collected[0].metric(0).label(),
|
collected[0].metric.at(0).label,
|
||||||
testing::AllOf(
|
testing::AllOf(
|
||||||
testing::ElementsAre(testing::Property(
|
testing::ElementsAre(testing::Field(&Label::name, kLabelKey)),
|
||||||
&io::prometheus::client::LabelPair::name, kLabelKey)),
|
testing::ElementsAre(testing::Field(&Label::value, kLabelValue))));
|
||||||
testing::ElementsAre(testing::Property(
|
EXPECT_THAT(collected[0].metric.at(0).counter.value,
|
||||||
&io::prometheus::client::LabelPair::value, kLabelValue))));
|
|
||||||
EXPECT_THAT(collected[0].metric(0).counter().value(),
|
|
||||||
testing::DoubleEq(expected_value));
|
testing::DoubleEq(expected_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,22 +88,20 @@ TEST(MetricsTest, CollectGauge) {
|
||||||
kGauge->Decrement();
|
kGauge->Decrement();
|
||||||
kGauge->Decrement(2);
|
kGauge->Decrement(2);
|
||||||
double expected_value = 1 + 5 - 1 - 2;
|
double expected_value = 1 + 5 - 1 - 2;
|
||||||
std::vector<::io::prometheus::client::MetricFamily> collected;
|
std::vector<::prometheus::MetricFamily> collected;
|
||||||
{
|
{
|
||||||
std::shared_ptr<::prometheus::Collectable> collectable;
|
std::shared_ptr<::prometheus::Collectable> collectable;
|
||||||
CHECK(collectable = factory.GetCollectable().lock());
|
CHECK(collectable = factory.GetCollectable().lock());
|
||||||
collected = collectable->Collect();
|
collected = collectable->Collect();
|
||||||
}
|
}
|
||||||
ASSERT_EQ(collected.size(), 1);
|
ASSERT_EQ(collected.size(), 1);
|
||||||
ASSERT_EQ(collected[0].metric_size(), 1);
|
ASSERT_EQ(collected[0].metric.size(), 1);
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
collected[0].metric(0).label(),
|
collected[0].metric.at(0).label,
|
||||||
testing::AllOf(
|
testing::AllOf(
|
||||||
testing::ElementsAre(testing::Property(
|
testing::ElementsAre(testing::Field(&Label::name, kLabelKey)),
|
||||||
&io::prometheus::client::LabelPair::name, kLabelKey)),
|
testing::ElementsAre(testing::Field(&Label::value, kLabelValue))));
|
||||||
testing::ElementsAre(testing::Property(
|
EXPECT_THAT(collected[0].metric.at(0).gauge.value,
|
||||||
&io::prometheus::client::LabelPair::value, kLabelValue))));
|
|
||||||
EXPECT_THAT(collected[0].metric(0).gauge().value(),
|
|
||||||
testing::DoubleEq(expected_value));
|
testing::DoubleEq(expected_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,24 +111,23 @@ TEST(MetricsTest, CollectHistogram) {
|
||||||
|
|
||||||
Algorithm algorithm;
|
Algorithm algorithm;
|
||||||
algorithm.Run();
|
algorithm.Run();
|
||||||
std::vector<::io::prometheus::client::MetricFamily> collected;
|
std::vector<::prometheus::MetricFamily> collected;
|
||||||
{
|
{
|
||||||
std::shared_ptr<::prometheus::Collectable> collectable;
|
std::shared_ptr<::prometheus::Collectable> collectable;
|
||||||
CHECK(collectable = registry.GetCollectable().lock());
|
CHECK(collectable = registry.GetCollectable().lock());
|
||||||
collected = collectable->Collect();
|
collected = collectable->Collect();
|
||||||
}
|
}
|
||||||
ASSERT_EQ(collected.size(), 1);
|
ASSERT_EQ(collected.size(), 1);
|
||||||
ASSERT_EQ(collected[0].metric_size(), 1);
|
ASSERT_EQ(collected[0].metric.size(), 1);
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
collected[0].metric(0).label(),
|
collected[0].metric.at(0).label,
|
||||||
testing::AllOf(
|
testing::AllOf(
|
||||||
testing::ElementsAre(testing::Property(
|
testing::ElementsAre(testing::Field(&Label::name, kLabelKey)),
|
||||||
&io::prometheus::client::LabelPair::name, kLabelKey)),
|
testing::ElementsAre(testing::Field(&Label::value, kLabelValue))));
|
||||||
testing::ElementsAre(testing::Property(
|
EXPECT_THAT(collected[0].metric.at(0).histogram.sample_count,
|
||||||
&io::prometheus::client::LabelPair::value, kLabelValue))));
|
|
||||||
EXPECT_THAT(collected[0].metric(0).histogram().sample_count(),
|
|
||||||
testing::Eq(kObserveScores.size()));
|
testing::Eq(kObserveScores.size()));
|
||||||
EXPECT_EQ(collected[0].metric(0).histogram().bucket(0).cumulative_count(), 1);
|
EXPECT_EQ(collected[0].metric.at(0).histogram.bucket.at(0).cumulative_count,
|
||||||
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MetricsTest, RunExposerServer) {
|
TEST(MetricsTest, RunExposerServer) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ sudo apt-get install -y \
|
||||||
google-mock \
|
google-mock \
|
||||||
libboost-all-dev \
|
libboost-all-dev \
|
||||||
libcairo2-dev \
|
libcairo2-dev \
|
||||||
|
libcurl4-openssl-dev \
|
||||||
libeigen3-dev \
|
libeigen3-dev \
|
||||||
libgflags-dev \
|
libgflags-dev \
|
||||||
libgoogle-glog-dev \
|
libgoogle-glog-dev \
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o verbose
|
set -o verbose
|
||||||
|
|
||||||
VERSION="v0.2"
|
COMMIT="4e0814ee3f93b796356a51a4795a332568940a72"
|
||||||
# Digest: a5d981dab82ad6b90f78141eb189694d69c3fe0f
|
|
||||||
|
|
||||||
git clone --branch ${VERSION} --depth 1 https://github.com/jupp0r/prometheus-cpp.git
|
git clone --depth 1 https://github.com/jupp0r/prometheus-cpp.git
|
||||||
cd prometheus-cpp
|
cd prometheus-cpp
|
||||||
|
git checkout ${COMMIT}
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
|
Loading…
Reference in New Issue