/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 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. ==============================================================================*/ // Standard format in which the metrics are collected, before being exported. // These are to be used only by the CollectionRegistry and exporters which // collect metrics using the CollectionRegistry. #ifndef THIRD_PARTY_TENSORFLOW_CORE_LIB_MONITORING_COLLECTED_METRICS_H_ #define THIRD_PARTY_TENSORFLOW_CORE_LIB_MONITORING_COLLECTED_METRICS_H_ #include #include #include #include #include "tensorflow/core/framework/summary.pb.h" #include "tensorflow/core/lib/monitoring/metric_def.h" namespace tensorflow { namespace monitoring { // A metric is a statistic about a monitorable entity. // // Metrics are named with path-like strings, which must conform to the regular // expression (/[a-zA-Z0-9_-]+)+. For example: // // /proc/cpu_usage // /rpc/client/count // // Metrics may optionally have labels, which are additional dimensions used to // identify the metric's values. For example, the metric /rpc/client/count // might have two labels named "rpc_service" and "rpc_method". // // A label name must be an identifier, which conform to the regular expression // [a-zA-Z_][a-zA-Z_0-9]*, and is only unique within the context of the metric // it is a label for. // // MetricDescriptor defines the structure of the metric (e.g. the fact that it's // a counter and that it has two labels named "rpc_service" and "rpc_method"). // Individual points will provide a value for the metric (e.g. the counter // value) and specific values for each of the labels. // // There's no scoping relationship between metrics and monitorable entities: the // metric /rpc/client/count should be defined the same way no matter which // monitorable entity is exporting it. struct MetricDescriptor { // Metric names are path-like. E.g., "/mycomponent/mymetric". string name; // A human-readable description of what this metric measures. string description; // Label names for the metric. // See the example in the top level comment for MetricDescriptor. std::vector label_names; MetricKind metric_kind; ValueType value_type; }; struct Point { // Usually a Point should provide a |label| field for each of the labels // defined in the corresponding MetricDescriptor. During transitions in // metric definitions, however, there may be times when a Point provides more // or fewer labels than those that appear in the MetricDescriptor. struct Label { // The |name| field must match the |label_name| field in the // MetricDescriptor for this Point. string name; string value; }; std::vector