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

public_url: "https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/third-party/hbase"
app_url: "https://hbase.apache.org/"
short_name: HBase
long_name: Apache HBase
logo_path: /stackdriver/images/hbase.png # supplied by google technical writer
description: |-
  The Apache HBase integration collects cluster metrics from `master` and region
  servers. Region server metrics are related to storage as well as request and
  latency. The integration also collects `master` and region server logs and
  parses them into a JSON payload. The result includes fields for source, level,
  and message.
configure_integration: |-
  To expose a JMX endpoint, you must set the `com.sun.management.jmxremote.port`
  system property when starting the JVM. We also recommend setting the
  `com.sun.management.jmxremote.rmi.port` system property to the same port. To
  expose a JMX endpoint remotely, you must also set the `java.rmi.server.hostname`
  system property.

  By default, these properties are set in a HBase deployment's `hbase-env.sh`
  file.

  To set system properties by using command-line arguments, prepend the property
  name with `-D` when starting the JVM. For example, to set
  `com.sun.management.jmxremote.port` to port `10101`, specify the following when
  starting the JVM:

  <pre>
  -Dcom.sun.management.jmxremote.port=10101
  </pre>
minimum_supported_agent_version:
  metrics: 2.11.0
  logging: 2.11.0
platforms_to_skip:
  # Hbase only supports Java 11, which has no installation candidate for Debian 12
  - debian-cloud:debian-12
  - debian-cloud:debian-12-arm64
supported_operating_systems: linux
supported_app_version: ["1.7.x", "2.3.x", "2.4.x"]
expected_metrics:
  - type: workload.googleapis.com/hbase.master.region_server.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/hbase.master.regions_in_transition.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/hbase.master.regions_in_transition.oldest_age
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/hbase.master.regions_in_transition.over_threshold
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/hbase.region_server.active_handler.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.authentication.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.block_cache.operation.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.blocked_update.time
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.disk.store_file.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.disk.store_file.size
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.files.local
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.gc.old_gen.time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
    optional: true
  - type: workload.googleapis.com/hbase.region_server.gc.time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.gc.young_gen.time
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
    optional: true
  - type: workload.googleapis.com/hbase.region_server.open_connection.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.append.latency.max
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.append.latency.mean
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.append.latency.median
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.append.latency.min
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.append.latency.p99
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
    representative: true
  - type: workload.googleapis.com/hbase.region_server.operation.delete.latency.max
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.delete.latency.mean
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.delete.latency.median
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.delete.latency.min
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.delete.latency.p99
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.get.latency.max
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.get.latency.mean
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.get.latency.median
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.get.latency.min
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.get.latency.p99
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.increment.latency.max
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.increment.latency.mean
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.increment.latency.median
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.increment.latency.min
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.increment.latency.p99
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.put.latency.max
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.put.latency.mean
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.put.latency.median
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.put.latency.min
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.put.latency.p99
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.replay.latency.max
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.replay.latency.mean
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.replay.latency.median
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.replay.latency.min
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operation.replay.latency.p99
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.operations.slow
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: operation
        value_regex: .*
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.queue.length
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.queue.request.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.region.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.request.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/hbase.region_server.write_ahead_log.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: region_server
        value_regex: .*
expected_logs:
  - log_name: hbase_system
    fields:
      - name: jsonPayload.message
        value_regex: 'master.HMaster: STARTING service HMaster'
        type: string
        description: 'Log message, including detailed stacktrace where provided'
      - name: jsonPayload.module
        value_regex: main
        type: string
        description: 'Module of hbase where the log originated'
      - name: jsonPayload.source
        value_regex: master.HMaster
        type: string
        description: 'source of where the log originated'
      - name: jsonPayload.level
        type: string
        description: Log entry level
        optional: true
      - name: severity
        type: string
        description: ''
configuration_options:
  logs:
    - type: hbase_system
      fields:
        - name: type
          default: null
          description: This value must be `hbase_system`.
        - name: include_paths
          default: '[/opt/hbase/logs/hbase-*-regionserver-*.log, /opt/hbase/logs/hbase-*-master-*.log]'
          description: A list of filesystem paths to read by tailing each file. A wild card (`*`) can be used in the paths; for example, `/var/log/hbase*/*.log`.
        - name: exclude_paths
          default: null
          description: A list of filesystem path patterns to exclude from the set matched by `include_paths`.
        - name: record_log_file_path
          default: false
          description: If set to `true`, then the path to the specific file from which the log record was obtained appears in the output log entry as the value of the `agent.googleapis.com/log_file_path` label. When using a wildcard, only the path of the file from which the record was obtained is recorded.
        - name: wildcard_refresh_interval
          default: 60s
          description: The interval at which wildcard file paths in `include_paths` are refreshed. Given as a [time duration](https://pkg.go.dev/time#ParseDuration), for example `30s` or `2m`. This property might be useful under high logging throughputs where log files are rotated faster than the default interval.
  metrics:
    - type: hbase
      fields:
        - name: type
          default: null
          description: This value must be `hbase`.
        - name: endpoint
          default: localhost:10101
          description: The [JMX Service URL](https://docs.oracle.com/javase/8/docs/api/javax/management/remote/JMXServiceURL.html) or host and port used to construct the service URL. This value must be in the form of `service:jmx:<protocol>:<sap>` or `host:port`. Values in `host:port` form are used to create a service URL of `service:jmx:rmi:///jndi/rmi://<host>:<port>/jmxrmi`.
        - name: collect_jvm_metrics
          default: true
          description: Configures the receiver to also collect the supported JVM metrics.
        - name: username
          default: null
          description: The configured username if JMX is configured to require authentication.
        - name: password
          default: null
          description: The configured password if JMX is configured to require authentication.
        - name: collection_interval
          default: 60s
          description: A [time duration](https://pkg.go.dev/time#ParseDuration) value, such as `30s` or `5m`.
