Skip to content
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

Remove exporting symbols #22623

Merged
merged 3 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ cc_library(
srcs = [
"src/ray/stats/metric.cc",
"src/ray/stats/metric_defs.cc",
"src/ray/stats/tag_defs.cc",
],
hdrs = [
"src/ray/stats/metric.h",
Expand Down
3 changes: 3 additions & 0 deletions src/ray/internal/internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ std::vector<rpc::ObjectReference> SendInternal(const ActorID &peer_actor_id,
}
return result.value();
}
const ray::stats::TagKeyType TagRegister(const std::string tag_name) {
return ray::stats::TagKeyType::Register(tag_name);
}
} // namespace internal
} // namespace ray
2 changes: 2 additions & 0 deletions src/ray/internal/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "ray/common/buffer.h"
#include "ray/common/id.h"
#include "ray/core_worker/common.h"
#include "ray/stats/metric.h"

// This header is used to warp some internal code so we can reduce suspicious
// symbols export.
Expand All @@ -33,5 +34,6 @@ std::vector<rpc::ObjectReference> SendInternal(const ActorID &peer_actor_id,
std::shared_ptr<LocalMemoryBuffer> buffer,
RayFunction &function, int return_num);

const stats::TagKeyType TagRegister(const std::string tag_name);
} // namespace internal
} // namespace ray
5 changes: 2 additions & 3 deletions src/ray/ray_exported_symbols.lds
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
*ray*ObjectReference*
# Others
*ray*metrics*
*opencensus*;
*ray*stats*
*ray*rpc*
*ray*gcs*
*ray*CoreWorker*
*ray*PeriodicalRunner*;
*ray*PeriodicalRunner*
*ray*internal*
*PyInit__raylet*
*Java_io_ray*
_JNI_On*
*ray*internal*
3 changes: 1 addition & 2 deletions src/ray/ray_version_script.lds
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ VERSION_1.0 {
*ray*ObjectReference*;
# Others
*ray*metrics*;
*opencensus*;
*ray*rpc*;
*ray*gcs*;
*ray*stats*;
*ray*CoreWorker*;
*ray*PeriodicalRunner*;
*ray*internal*;
*PyInit*;
*init_raylet*;
*Java*;
*JNI_*;
*ray*internal*;
*aligned_free*;
*aligned_malloc*;
local: *;
Expand Down
2 changes: 2 additions & 0 deletions src/ray/stats/metric.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ void Metric::Record(double value,
Record(value, tags_pair_vec);
}

Metric::~Metric() { opencensus::stats::StatsExporter::RemoveView(name_); }

void Gauge::RegisterView() {
opencensus::stats::ViewDescriptor view_descriptor =
opencensus::stats::ViewDescriptor()
Expand Down
2 changes: 1 addition & 1 deletion src/ray/stats/metric.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Metric {
tag_keys_(tag_keys),
measure_(nullptr) {}

virtual ~Metric() { opencensus::stats::StatsExporter::RemoveView(name_); }
virtual ~Metric();

Metric &operator()() { return *this; }

Expand Down
39 changes: 39 additions & 0 deletions src/ray/stats/tag_defs.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2017 The Ray 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.

#include "ray/stats/metric.h"

namespace ray {
namespace stats {
const TagKeyType ComponentKey = TagKeyType::Register("Component");

const TagKeyType JobNameKey = TagKeyType::Register("JobName");

const TagKeyType CustomKey = TagKeyType::Register("CustomKey");

const TagKeyType NodeAddressKey = TagKeyType::Register("NodeAddress");

const TagKeyType VersionKey = TagKeyType::Register("Version");

const TagKeyType LanguageKey = TagKeyType::Register("Language");

const TagKeyType WorkerPidKey = TagKeyType::Register("WorkerPid");

const TagKeyType DriverPidKey = TagKeyType::Register("DriverPid");

const TagKeyType ResourceNameKey = TagKeyType::Register("ResourceName");

const TagKeyType ActorIdKey = TagKeyType::Register("ActorId");
} // namespace stats
} // namespace ray
20 changes: 10 additions & 10 deletions src/ray/stats/tag_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
using TagKeyType = opencensus::tags::TagKey;
using TagsType = std::vector<std::pair<opencensus::tags::TagKey, std::string>>;

static const TagKeyType ComponentKey = TagKeyType::Register("Component");
extern const TagKeyType ComponentKey;

static const TagKeyType JobNameKey = TagKeyType::Register("JobName");
extern const TagKeyType JobNameKey;

static const TagKeyType CustomKey = TagKeyType::Register("CustomKey");
extern const TagKeyType CustomKey;

static const TagKeyType NodeAddressKey = TagKeyType::Register("NodeAddress");
extern const TagKeyType NodeAddressKey;

static const TagKeyType VersionKey = TagKeyType::Register("Version");
extern const TagKeyType VersionKey;

static const TagKeyType LanguageKey = TagKeyType::Register("Language");
extern const TagKeyType LanguageKey;

static const TagKeyType WorkerPidKey = TagKeyType::Register("WorkerPid");
extern const TagKeyType WorkerPidKey;

static const TagKeyType DriverPidKey = TagKeyType::Register("DriverPid");
extern const TagKeyType DriverPidKey;

static const TagKeyType ResourceNameKey = TagKeyType::Register("ResourceName");
extern const TagKeyType ResourceNameKey;

static const TagKeyType ActorIdKey = TagKeyType::Register("ActorId");
extern const TagKeyType ActorIdKey;