Merge pull request #19957 from g-easy/tags

Use opencensus::tags::TagKey.
reviewable/pr19036/r5
Vijay Pai 5 years ago committed by GitHub
commit 5bf8760d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      src/core/ext/filters/load_reporting/registered_opencensus_objects.h
  2. 17
      src/cpp/ext/filters/census/grpc_plugin.cc
  3. 9
      src/cpp/ext/filters/census/grpc_plugin.h
  4. 11
      src/cpp/server/load_reporter/load_reporter.cc
  5. 11
      src/cpp/server/load_reporter/load_reporter.h

@ -22,6 +22,7 @@
#include <grpc/support/port_platform.h>
#include "opencensus/stats/stats.h"
#include "opencensus/tags/tag_key.h"
#include "src/cpp/server/load_reporter/constants.h"
@ -80,33 +81,33 @@ inline ::opencensus::stats::MeasureDouble MeasureOtherCallMetric() {
// Tags.
inline ::opencensus::stats::TagKey TagKeyToken() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyToken);
inline ::opencensus::tags::TagKey TagKeyToken() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyToken);
return token;
}
inline ::opencensus::stats::TagKey TagKeyHost() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyHost);
inline ::opencensus::tags::TagKey TagKeyHost() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyHost);
return token;
}
inline ::opencensus::stats::TagKey TagKeyUserId() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyUserId);
inline ::opencensus::tags::TagKey TagKeyUserId() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyUserId);
return token;
}
inline ::opencensus::stats::TagKey TagKeyStatus() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyStatus);
inline ::opencensus::tags::TagKey TagKeyStatus() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyStatus);
return token;
}
inline ::opencensus::stats::TagKey TagKeyMetricName() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyMetricName);
inline ::opencensus::tags::TagKey TagKeyMetricName() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyMetricName);
return token;
}

@ -22,6 +22,7 @@
#include <grpcpp/server_context.h>
#include "opencensus/tags/tag_key.h"
#include "opencensus/trace/span.h"
#include "src/cpp/ext/filters/census/channel_filter.h"
#include "src/cpp/ext/filters/census/client_filter.h"
@ -33,27 +34,27 @@ namespace grpc {
// These measure definitions should be kept in sync across opencensus
// implementations--see
// https://github.com/census-instrumentation/opencensus-java/blob/master/contrib/grpc_metrics/src/main/java/io/opencensus/contrib/grpc/metrics/RpcMeasureConstants.java.
::opencensus::stats::TagKey ClientMethodTagKey() {
::opencensus::tags::TagKey ClientMethodTagKey() {
static const auto method_tag_key =
::opencensus::stats::TagKey::Register("grpc_client_method");
::opencensus::tags::TagKey::Register("grpc_client_method");
return method_tag_key;
}
::opencensus::stats::TagKey ClientStatusTagKey() {
::opencensus::tags::TagKey ClientStatusTagKey() {
static const auto status_tag_key =
::opencensus::stats::TagKey::Register("grpc_client_status");
::opencensus::tags::TagKey::Register("grpc_client_status");
return status_tag_key;
}
::opencensus::stats::TagKey ServerMethodTagKey() {
::opencensus::tags::TagKey ServerMethodTagKey() {
static const auto method_tag_key =
::opencensus::stats::TagKey::Register("grpc_server_method");
::opencensus::tags::TagKey::Register("grpc_server_method");
return method_tag_key;
}
::opencensus::stats::TagKey ServerStatusTagKey() {
::opencensus::tags::TagKey ServerStatusTagKey() {
static const auto status_tag_key =
::opencensus::stats::TagKey::Register("grpc_server_status");
::opencensus::tags::TagKey::Register("grpc_server_status");
return status_tag_key;
}

@ -24,6 +24,7 @@
#include "absl/strings/string_view.h"
#include "include/grpcpp/opencensus.h"
#include "opencensus/stats/stats.h"
#include "opencensus/tags/tag_key.h"
namespace grpc_impl {
class ServerContext;
@ -32,10 +33,10 @@ class ServerContext;
namespace grpc {
// The tag keys set when recording RPC stats.
::opencensus::stats::TagKey ClientMethodTagKey();
::opencensus::stats::TagKey ClientStatusTagKey();
::opencensus::stats::TagKey ServerMethodTagKey();
::opencensus::stats::TagKey ServerStatusTagKey();
::opencensus::tags::TagKey ClientMethodTagKey();
::opencensus::tags::TagKey ClientStatusTagKey();
::opencensus::tags::TagKey ServerMethodTagKey();
::opencensus::tags::TagKey ServerStatusTagKey();
// Names of measures used by the plugin--users can create views on these
// measures but should not record data for them.

@ -29,6 +29,7 @@
#include "src/cpp/server/load_reporter/load_reporter.h"
#include "opencensus/stats/internal/set_aggregation_window.h"
#include "opencensus/tags/tag_key.h"
namespace grpc {
namespace load_reporter {
@ -38,12 +39,12 @@ CpuStatsProvider::CpuStatsSample CpuStatsProviderDefaultImpl::GetCpuStats() {
}
CensusViewProvider::CensusViewProvider()
: tag_key_token_(::opencensus::stats::TagKey::Register(kTagKeyToken)),
tag_key_host_(::opencensus::stats::TagKey::Register(kTagKeyHost)),
tag_key_user_id_(::opencensus::stats::TagKey::Register(kTagKeyUserId)),
tag_key_status_(::opencensus::stats::TagKey::Register(kTagKeyStatus)),
: tag_key_token_(::opencensus::tags::TagKey::Register(kTagKeyToken)),
tag_key_host_(::opencensus::tags::TagKey::Register(kTagKeyHost)),
tag_key_user_id_(::opencensus::tags::TagKey::Register(kTagKeyUserId)),
tag_key_status_(::opencensus::tags::TagKey::Register(kTagKeyStatus)),
tag_key_metric_name_(
::opencensus::stats::TagKey::Register(kTagKeyMetricName)) {
::opencensus::tags::TagKey::Register(kTagKeyMetricName)) {
// One view related to starting a call.
auto vd_start_count =
::opencensus::stats::ViewDescriptor()

@ -34,6 +34,7 @@
#include "src/proto/grpc/lb/v1/load_reporter.grpc.pb.h"
#include "opencensus/stats/stats.h"
#include "opencensus/tags/tag_key.h"
namespace grpc {
namespace load_reporter {
@ -75,11 +76,11 @@ class CensusViewProvider {
private:
ViewDescriptorMap view_descriptor_map_;
// Tag keys.
::opencensus::stats::TagKey tag_key_token_;
::opencensus::stats::TagKey tag_key_host_;
::opencensus::stats::TagKey tag_key_user_id_;
::opencensus::stats::TagKey tag_key_status_;
::opencensus::stats::TagKey tag_key_metric_name_;
::opencensus::tags::TagKey tag_key_token_;
::opencensus::tags::TagKey tag_key_host_;
::opencensus::tags::TagKey tag_key_user_id_;
::opencensus::tags::TagKey tag_key_status_;
::opencensus::tags::TagKey tag_key_metric_name_;
};
// The default implementation fetches the real stats from Census.

Loading…
Cancel
Save