# Copyright 2022 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
#
#      https://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.

name: mounts

attributes:
  instance:
    description: NFS Proxy instance

  server:
    description: NFS mount's server

  operation:
    description: NFS operation name

metrics:
  # TODO: Change metrics to use a cumulative sum (counter) instead of a gauge

  nfs.mount.read_exe:
    enabled: true
    description: nfsiostat Mount Read EXE
    extended_documentation: The average read operation EXE per NFS client mount over the past 60 seconds (Knfsd --> Source Filer)
    unit: ms
    attributes: [server, instance]
    gauge:
      value_type: double

  nfs.mount.read_rtt:
    enabled: true
    description: nfsiostat Mount Read RTT
    extended_documentation: The average read operation RTT per NFS client mount over the past 60 seconds (Knfsd --> Source Filer)
    unit: ms
    attributes: [server, instance]
    gauge:
      value_type: double

  nfs.mount.write_exe:
    enabled: true
    description: nfsiostat Mount Write EXE
    extended_documentation: The average write operation EXE per NFS client mount over the past 60 seconds (Knfsd --> Source Filer)
    unit: ms
    attributes: [server, instance]
    gauge:
      value_type: double

  nfs.mount.write_rtt:
    enabled: true
    description: nfsiostat Mount Write RTT
    extended_documentation: The average write operation RTT per NFS client mount over the past 60 seconds (Knfsd --> Source Filer)
    unit: ms
    attributes: [server, instance]
    gauge:
      value_type: double

  nfs.mount.ops_per_second:
    enabled: true
    description: nfsiostat Mount Operations Per Second
    extended_documentation: The number of NFS operations per second per NFS client mount over the past 60 seconds (Knfsd --> Source Filer)
    unit: 1
    attributes: [server, instance]
    gauge:
      value_type: double

  nfs.mount.rpc_backlog:
    enabled: true
    description: "nfsiostat Mount RPC Backlog"
    extended_documentation: The RPC Backlog per NFS client mount over the past 60 seconds (Knfsd --> Source Filer)
    unit: 1
    attributes: [server, instance]
    gauge:
      value_type: double

  nfs.mount.read_bytes:
    enabled: true
    description: Bytes read from remote NFS server
    unit: By
    attributes: [server, instance]
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative

  nfs.mount.write_bytes:
    enabled: true
    description: Bytes wrote to remote NFS server
    unit: By
    attributes: [server, instance]
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative

  nfs.mount.operation.requests:
    enabled: true
    description: Number of requests
    unit: '{requests}'
    attributes: [server, instance, operation]
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative

  nfs.mount.operation.sent_bytes:
    enabled: true
    description: Total bytes sent for these operations, including RPC headers and payload
    unit: By
    attributes: [server, instance, operation]
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative

  nfs.mount.operation.received_bytes:
    enabled: true
    description: Total bytes received for these operations, including RPC headers and payload
    unit: By
    attributes: [server, instance, operation]
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative

  nfs.mount.operation.major_timeouts:
    enabled: true
    description: Number of times a request has had a major timeout
    unit: '{timeouts}'
    attributes: [server, instance, operation]
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative

  nfs.mount.operation.errors:
    enabled: true
    description: Number of requests that complete with tk_status < 0
    unit: '{errors}'
    attributes: [server, instance, operation]
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative
