// Copyright 2023 Google LLC
//
// 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.

syntax = "proto3";

package stats;

option go_package = "github.com/bazelbuild/reclient/api/stat";

// Outlier represents a command with an unusually large value in the stat.
message Outlier {
  string command_id = 1;
  int64 value = 2;
}

message Stat {
  // The metric/stat name.
  string name = 1;

  // The number of all the true values for booleans, the sum of all the
  // values for ints.
  int64 count = 2;

  message Value {
    string name = 1;
    int64 count = 2;
  }
  // For enum stats, the count of each value.
  repeated Value counts_by_value = 3;

  // A list of commands that have the highest values.
  repeated Outlier outliers = 4;

  int64 median = 5;
  int64 percentile75 = 6;
  int64 percentile85 = 7;
  int64 percentile95 = 8;
  double average = 9;
}