// Copyright 2026 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 google.cloud.databasecenter.v1beta;

import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.DatabaseCenter.V1Beta";
option go_package = "cloud.google.com/go/databasecenter/apiv1beta/databasecenterpb;databasecenterpb";
option java_multiple_files = true;
option java_outer_classname = "MetricDataProto";
option java_package = "com.google.cloud.databasecenter.v1beta";
option php_namespace = "Google\\Cloud\\DatabaseCenter\\V1beta";
option ruby_package = "Google::Cloud::DatabaseCenter::V1beta";

// Metrics represents the metrics for a database resource.
message Metrics {
  // P99 CPU utilization observed for the resource. The value is a
  // fraction between 0.0 and 1.0 (may momentarily exceed 1.0 in some cases).
  optional MetricData p99_cpu_utilization = 1;

  // P95 CPU utilization observed for the resource. The value is a
  // fraction between 0.0 and 1.0 (may momentarily exceed 1.0 in some cases).
  optional MetricData p95_cpu_utilization = 2;

  // Current storage used by the resource in bytes.
  optional MetricData current_storage_used_bytes = 3;

  // Peak storage utilization observed for the resource. The value is a
  // fraction between 0.0 and 1.0 (may momentarily exceed 1.0 in some cases).
  optional MetricData peak_storage_utilization = 4;

  // Peak memory utilization observed for the resource. The value is a
  // fraction between 0.0 and 1.0 (may momentarily exceed 1.0 in some cases).
  optional MetricData peak_memory_utilization = 5;

  // Peak number of connections observed for the resource. The value is a
  // positive integer.
  optional MetricData peak_number_connections = 6;

  // Number of nodes in instance for spanner or bigtable.
  optional MetricData node_count = 7;

  // Number of processing units in spanner.
  optional MetricData processing_unit_count = 8;

  // Current memory used by the resource in bytes.
  optional MetricData current_memory_used_bytes = 9;
}

// MetricData represents the metric data for a database resource.
message MetricData {
  // The value associated with the metric.
  TypedValue value = 1;

  // The time the metric was observed in the metric source service.
  google.protobuf.Timestamp observation_time = 2;
}

// TypedValue represents the value of the metric based on data type.
message TypedValue {
  // The data type of metric value would be chosen based on the metric type.
  oneof value {
    // The value of the metric as double.
    double double_value = 1;

    // The value of the metric as int.
    int64 int64_value = 2;
  }
}
