# 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
#
#      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.

expected_metrics:
  - type: agent.googleapis.com/agent/api_request_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: state
        value_regex: OK|CANCELLED|UNKNOWN|INVALID_ARGUMENT|DEADLINE_EXCEEDED|NOT_FOUND|ALREADY_EXISTS|PERMISSION_DENIED|RESOURCE_EXHAUSTED|FAILED_PRECONDITION|ABORTED|OUT_OF_RANGE|UNIMPLEMENTED|INTERNAL|UNAVAILABLE|DATA_LOSS|UNAUTHENTICATED|CODE_\d+
  - type: agent.googleapis.com/agent/log_entry_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: response_code
        value_regex: \d+
  - type: agent.googleapis.com/agent/log_entry_retry_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: response_code
        value_regex: \d+
    optional: true
  - type: agent.googleapis.com/agent/memory_usage
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: agent.googleapis.com/agent/monitoring/point_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: status
        value_regex: OK|CANCELLED|UNKNOWN|INVALID_ARGUMENT|DEADLINE_EXCEEDED|NOT_FOUND|ALREADY_EXISTS|PERMISSION_DENIED|RESOURCE_EXHAUSTED|FAILED_PRECONDITION|ABORTED|OUT_OF_RANGE|UNIMPLEMENTED|INTERNAL|UNAVAILABLE|DATA_LOSS|UNAUTHENTICATED|CODE_\d+
  - type: agent.googleapis.com/agent/request_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: response_code
        value_regex: \d+
  - type: agent.googleapis.com/agent/uptime
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: version
        value_regex: google-cloud-ops-agent-(metrics|logging)/\d+[.]\d+[.]\d+.*
    representative: true
  - type: agent.googleapis.com/agent/ops_agent/enabled_receivers
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: receiver_type
        value_regex: .*
      - name: telemetry_type
        value_regex: logs|metrics
  - type: agent.googleapis.com/cpu/load_15m
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: agent.googleapis.com/cpu/load_1m
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: agent.googleapis.com/cpu/load_5m
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: agent.googleapis.com/cpu/usage_time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: cpu_number
        value_regex: \d*
      - name: cpu_state
        value_regex: idle|interrupt|nice|softirq|steal|system|used|user|wait
    optional: true
  - type: agent.googleapis.com/cpu/utilization
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: cpu_number
        value_regex: \d*
      - name: cpu_state
        value_regex: idle|interrupt|nice|softirq|steal|system|used|user|wait
  - type: agent.googleapis.com/disk/bytes_used
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: state
        value_regex: free|reserved|used
  - type: agent.googleapis.com/disk/io_time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
  - type: agent.googleapis.com/disk/merged_operations
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: direction
        value_regex: read|write
    platform: linux
  - type: agent.googleapis.com/disk/operation_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: direction
        value_regex: read|write
  - type: agent.googleapis.com/disk/operation_time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: direction
        value_regex: read|write
  - type: agent.googleapis.com/disk/pending_operations
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
  - type: agent.googleapis.com/disk/percent_used
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: state
        value_regex: free|reserved|used
  - type: agent.googleapis.com/disk/read_bytes_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
  - type: agent.googleapis.com/disk/weighted_io_time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
    platform: linux
  - type: agent.googleapis.com/disk/write_bytes_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
  - type: agent.googleapis.com/interface/errors
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: direction
        value_regex: tx|rx
  - type: agent.googleapis.com/interface/packets
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: direction
        value_regex: tx|rx
  - type: agent.googleapis.com/interface/traffic
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: direction
        value_regex: tx|rx
  - type: agent.googleapis.com/memory/bytes_used
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: state
        value_regex: buffered|cached|free|slab|used
  - type: agent.googleapis.com/memory/percent_used
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: state
        value_regex: buffered|cached|free|slab|used
  - type: agent.googleapis.com/network/tcp_connections
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: port
        value_regex: all
      - name: tcp_state
        value_regex: CLOSE|CLOSED|CLOSE_WAIT|CLOSING|DELETE|ESTABLISHED|FIN_WAIT_1|FIN_WAIT1|FIN_WAIT_2|FIN_WAIT2|LAST_ACK|LISTEN|SYN_RECEIVED|SYN_RECV|SYN_SENT|TIME_WAIT
  - type: agent.googleapis.com/pagefile/percent_used
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: state
        value_regex: free|used
    platform: windows
  - type: agent.googleapis.com/processes/count_by_state
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: state
        value_regex: blocked|daemon|detached|idle|locked|orphan|paging|running|sleeping|stopped|system|unknown|zombies
    platform: linux
  - type: agent.googleapis.com/processes/cpu_time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: command
        value_regex: .*
      - name: command_line
        value_regex: .*
      - name: owner
        value_regex: .*
      - name: pid
        value_regex: \d+
      - name: process
        value_regex: all
      - name: user_or_syst
        value_regex: user|syst
  - type: agent.googleapis.com/processes/disk/read_bytes_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: command
        value_regex: .*
      - name: command_line
        value_regex: .*
      - name: owner
        value_regex: .*
      - name: pid
        value_regex: \d+
      - name: process
        value_regex: all
  - type: agent.googleapis.com/processes/disk/write_bytes_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: command
        value_regex: .*
      - name: command_line
        value_regex: .*
      - name: owner
        value_regex: .*
      - name: pid
        value_regex: \d+
      - name: process
        value_regex: all
  - type: agent.googleapis.com/processes/fork_count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    platform: linux
  - type: agent.googleapis.com/processes/rss_usage
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: command
        value_regex: .*
      - name: command_line
        value_regex: .*
      - name: owner
        value_regex: .*
      - name: pid
        value_regex: \d+
      - name: process
        value_regex: all
  - type: agent.googleapis.com/processes/vm_usage
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: command
        value_regex: .*
      - name: command_line
        value_regex: .*
      - name: owner
        value_regex: .*
      - name: pid
        value_regex: \d+
      - name: process
        value_regex: all
  - type: agent.googleapis.com/processes/windows/handles
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    platform: windows
    labels:
      - name: command
        value_regex: .*
      - name: command_line
        value_regex: .*
      - name: owner
        value_regex: .*
      - name: pid
        value_regex: \d+
      - name: process
        value_regex: all
  - type: agent.googleapis.com/swap/bytes_used
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: state
        value_regex: cached|free|used
  - type: agent.googleapis.com/swap/io
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: direction
        value_regex: in|out
  - type: agent.googleapis.com/swap/percent_used
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: device
        value_regex: .*
      - name: state
        value_regex: cached|free|reserved|used
