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

app_url: "https://www.couchbase.com/"
short_name: Couchbase
long_name: Couchbase
logo_path: /stackdriver/images/integrations/couchbase.png # supplied by google technical writer
description: |-
  The Couchbase integration collects bucket metrics such as operations,
  memory usage, and ejections. The integration collects metrics from the
  Prometheus server exposed on a node. The integration also collects Couchbase
  general, HTTP access, and cross-datacenter ("goxdcr") logs.
supported_app_version: ["6.5", "6.6", "7.0"]
expected_logs:
  - log_name: couchbase_general
    fields:
      - name: jsonPayload.message
        type: string
        description: "Log message"
        optional: true
      - name: jsonPayload.node_name
        type: string
        description: The name of the node issuing the log message
      - name: jsonPayload.module_name
        type: string
        description: The name of the module issuing the entry
        optional: true
      - name: jsonPayload.source
        type: string
        description: Source where the log originated
        optional: true
      - name: jsonPayload.type
        type: string
        description: The type of log
        optional: true
      - name: jsonPayload.level
        type: string
        description: Log entry severity for the couchbase log
        optional: true
      - name: severity
        type: string
        description: ''
  - log_name: couchbase_http_access
    fields:
      - name: httpRequest.remoteIp
        value_regex: ::1|127.0.0.1
        type: string
        description: The IP address (IPv4 or IPv6) of the client that issued the HTTP request
        optional: true
      - name: httpRequest.requestUrl
        type: string
        description: Request URL (typically just the path part of the URL)
        optional: true
      - name: httpRequest.protocol
        type: string
        description: Protocol used for the request
        optional: true
      - name: httpRequest.requestMethod
        value_regex: GET
        type: string
        description: HTTP method
        optional: true
      - name: httpRequest.status
        type: number
        description: HTTP status code
        optional: true
      - name: httpRequest.responseSize
        type: string
        description: ''
        optional: true
      - name: httpRequest.userAgent
        type: string
        description: ''
        optional: true
      - name: jsonPayload.message
        type: string
        description: "Log message"
      - name: jsonPayload.host
        type: string
        description: The IP address of the client invoking the HTTP request
        optional: true
      - name: jsonPayload.level
        type: string
        description: Log entry severity for the couchbase log
        optional: true
      - name: jsonPayload.user
        type: string
        description: The name of the user making the HTTP request if basic auth is used.
        optional: true
      - name: severity
        type: string
        description: ''
  - log_name: couchbase_goxdcr
    fields:
      - name: jsonPayload.message
        type: string
        description: "Log message"
      - name: jsonPayload.log_type
        type: string
        description: The name of the component that is issuing the cross-datacenter log
        optional: true
      - name: jsonPayload.level
        type: string
        description: Log entry severity for the couchbase log
        optional: true
      - name: severity
        type: string
        description: ''
expected_metrics:
  - type: workload.googleapis.com/couchbase.bucket.operation.count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: bucket_name
        value_regex: .*
      - name: op
        value_regex: .*
  - type: workload.googleapis.com/couchbase.bucket.item.count
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: bucket_name
        value_regex: .*
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/couchbase.bucket.vbucket.count
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: bucket_name
        value_regex: .*
      - name: state
        value_regex: .*
  - type: workload.googleapis.com/couchbase.bucket.memory.usage
    value_type: DOUBLE
    kind: GAUGE
    labels:
      - name: bucket_name
        value_regex: .*
    monitored_resources: [gce_instance]
    representative: true
  - type: workload.googleapis.com/couchbase.bucket.item.ejection.count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: bucket_name
        value_regex: .*
  - type: workload.googleapis.com/couchbase.bucket.error.oom.count
    value_type: INT64
    kind: CUMULATIVE
    labels:
      - name: bucket_name
        value_regex: .*
      - name: error_type
        value_regex: .*
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/couchbase.bucket.memory.high_water_mark.limit
    value_type: DOUBLE
    kind: GAUGE
    labels:
      - name: bucket_name
        value_regex: .*
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/couchbase.bucket.memory.low_water_mark.limit
    value_type: DOUBLE
    kind: GAUGE
    labels:
      - name: bucket_name
        value_regex: .*
    monitored_resources: [gce_instance]
configuration_options:
  metrics:
    - type: couchbase
      fields:
        - name: type
          default: null
          description: This value must be `couchbase`.
        - name: endpoint
          default: localhost:8091
          description: The URL of the node to monitor.
        - name: collection_interval
          default: 60s
          description: A [time.Duration](https://pkg.go.dev/time#ParseDuration) value, such as `30s` or `5m`.
        - name: username
          description: The username used to connect to the Couchbase server.
        - name: password
          description: The password used to connect to the Couchbase server.
minimum_supported_agent_version:
  metrics: 2.18.2
  logging: 2.18.2
supported_operating_systems: linux
platforms_to_skip:
  # couchbase is not supported on various distros.
  # https://docs.couchbase.com/server/current/install/install-platforms.html
  - rocky-linux-cloud:rocky-linux-9
  - rocky-linux-cloud:rocky-linux-9-optimized-gcp
  - debian-cloud:debian-12
public_url: https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/third-party/couchbase
