go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/server/cmd/statsd-to-tsmon/config/config.proto (about)

     1  // Copyright 2020 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package statsd_to_tsmon.config;
    18  
    19  option go_package = "go.chromium.org/luci/server/cmd/statsd-to-tsmon/config";
    20  
    21  
    22  enum Kind {
    23    KIND_UNSPECIFIED = 0;
    24    GAUGE = 1;
    25    COUNTER = 2;
    26    CUMULATIVE_DISTRIBUTION = 3;
    27  }
    28  
    29  
    30  enum Unit {
    31    UNIT_UNSPECIFIED = 0;
    32    MILLISECONDS = 1;
    33    BYTES = 2;
    34  }
    35  
    36  
    37  message Config {
    38    // A collection of tsmon metrics and rules for how to extract them from statsd
    39    // metrics.
    40    repeated Metric metrics = 1;
    41  }
    42  
    43  
    44  message Metric {
    45    // Name of the tsmon metric to produce, required.
    46    string metric = 1;
    47    // A kind of the metric, required.
    48    Kind kind = 2;
    49    // Metric description. Optional, but recommended.
    50    string desc = 3;
    51    // Units of the metric value. Optional, but recommended.
    52    Unit units = 4;
    53    // A set of fields of this metric.
    54    repeated string fields = 5;
    55  
    56    // A list of rules that map statds metrics to fields of this metric.
    57    //
    58    // Each rule is represented by a statsd metric name pattern (that looks like
    59    // e.g. "something.*.${var}.*.sfx") and a recipe of how to get tsmon field
    60    // name of metrics matching the pattern.
    61    //
    62    // In the current implementation the last component of each pattern must be
    63    // some static string (i.e. not `*` and not a var) and all such suffixes must
    64    // be unique across the entire configuration file.
    65    repeated Rule rules = 6;
    66  }
    67  
    68  
    69  message Rule {
    70    // A pattern to match statsd metric name against.
    71    //
    72    // Also used to "extract" interesting portions of the metric name to use them
    73    // in `fields`.
    74    //
    75    // For example, if the pattern is "something.*.${var}.*.sfx", statds metric
    76    // "something.foo.val.bar.sfx" matches it, and `var` value is set to "val".
    77    string pattern = 1;
    78  
    79    // A map "field name => its value".
    80    //
    81    // The set of field names should be equal to the set of fields specified
    82    // in the metric definition.
    83    //
    84    // Each field value is either a static string ("foo"), or a reference to
    85    // some variable ("${var}") parsed from the statsd metric name according to
    86    // the pattern.
    87    map<string, string> fields = 2;
    88  }