# 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/mssql"
app_url: "https://docs.microsoft.com/sql/sql-server/"
short_name: SQL Server
long_name: Microsoft SQL Server
logo_path: /stackdriver/images/mssql.png # supplied by google technical writer
description: |-
  The v1 Microsoft SQL Server integration collects metrics from your SQL Server
  instances. The metrics provide transaction-rate information and also data on
  open connections.

  The v2 Microsoft SQL Server integration collects metrics from your SQL Server
  instances and databases. Page, batch, lock, and user connection count information
  is provided at the instance level. Transaction and transaction log information
  is provided at the database level.

  This integration doesn't support SQL Server named instances.
minimum_supported_agent_version:
  metrics: 2.15.0
supported_operating_systems: windows
platforms_to_skip:
  # Skip non-sql images.
  - windows-cloud:windows-2016-core
  - windows-cloud:windows-2022
supported_app_version: ["11.x", "12.x", "13.x", "14.x", "15.x", "16.x"]
expected_metrics:
  # v2 metrics
  - type: workload.googleapis.com/sqlserver.user.connection.count
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    representative: true
  - type: workload.googleapis.com/sqlserver.lock.wait_time.avg
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.lock.wait.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.batch.request.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.batch.sql_compilation.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.batch.sql_recompilation.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.page.buffer_cache.hit_ratio
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.page.life_expectancy
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.page.split.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.page.lazy_write.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.page.checkpoint.flush.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
  - type: workload.googleapis.com/sqlserver.page.operation.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: type
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction_log.growth.count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction_log.shrink.count
    value_type: INT64
    kind: CUMULATIVE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction_log.percent_used
    value_type: INT64
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction_log.flush.wait.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction_log.flush.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction_log.flush.data.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
  - type: workload.googleapis.com/sqlserver.transaction.write.rate
    value_type: DOUBLE
    kind: GAUGE
    monitored_resources: [gce_instance]
    labels:
      - name: database
        value_regex: .*
configuration_options:
  metrics:
    - type: mssql
      fields:
        - name: type
          default: null
          description: This value must be `mssql`.
        - name: collection_interval
          default: 60s
          description: A [time duration](https://pkg.go.dev/time#ParseDuration) value, such as `30s` or `5m`.
        - name: receiver_version
          default: "1"
          description: Version of the metrics collected; use `2` to collect v2 metrics.
