[Microsoft SQL Server] metrics for Always On Availability Groups#16759
[Microsoft SQL Server] metrics for Always On Availability Groups#16759jakubgalecki0 merged 16 commits intoelastic:mainfrom
Conversation
🚀 Benchmarks reportPackage
|
| Data stream | Previous EPS | New EPS | Diff (%) | Result |
|---|---|---|---|---|
performance |
4975.12 | 3846.15 | -1128.97 (-22.69%) | 💔 |
To see the full report comment with /test benchmark fullreport
bc08f4f to
37c9f9f
Compare
| - name: primary_recovery_health | ||
| type: long | ||
| metric_type: gauge | ||
| description: Primary replica recovery health (0 = ONLINE_IN_PROGRESS, 1 = ONLINE. NULL if not primary). |
There was a problem hiding this comment.
- Is this field going to get
NULLvalue? Should the field data type changed to acceptNULLvalue? - same applies for
seconday_recovery_healthfield.
There was a problem hiding this comment.
Yeah values can be NULL depending on replica we are connected to (primary/secondary). Adjusted data type to keyword.
There was a problem hiding this comment.
As per the Microsoft document, these fields are of type integer. I don't think we would get NULL values for these fields. Can you double check once?
There was a problem hiding this comment.
As I understand it according to the documentation, primary_recovery_health will be NULL if the host is a secondary replica, and likewise, secondary_recovery_health will be NULL if the host is the primary replica.
| @@ -1,4 +1,9 @@ | |||
| # newer versions go on top | |||
| - version: "2.15.1" | |||
There was a problem hiding this comment.
| - version: "2.15.1" | |
| - version: "2.16.0" |
Shall we increase the minor version instead of patch for the enhancement?
There was a problem hiding this comment.
updated version
| name: microsoft_sqlserver | ||
| title: "Microsoft SQL Server" | ||
| version: "2.15.0" | ||
| version: "2.15.1" |
There was a problem hiding this comment.
| version: "2.15.1" | |
| version: "2.16.0" |
| example: "stretch" | ||
| description: > | ||
| OS codename, if any. | ||
|
|
There was a problem hiding this comment.
None of the fields here are dimension fields. So we need not define them here.
| title: Microsoft SQL Server Always On Availability Groups metrics | ||
| description: Collect Microsoft SQL Server Always On Availability Groups metrics. Monitors overall AG health, synchronization status, and primary/secondary recovery state. | ||
| elasticsearch: | ||
| index_mode: "time_series" |
There was a problem hiding this comment.
Do we need to do TSDB testing for this ?
There was a problem hiding this comment.
result of tsdb testing
You're testing with version 8.19.0.
Testing data stream metrics-microsoft_sqlserver.availability_groups-default.
Index being used for the documents is .ds-metrics-microsoft_sqlserver.availability_groups-default-2026.01.26-000001.
Index being used for the settings and mappings is .ds-metrics-microsoft_sqlserver.availability_groups-default-2026.01.26-000002.
The time series fields for the TSDB index are:
- dimension (13 fields):
- agent.id
- cloud.account.id
- cloud.availability_zone
- cloud.instance.id
- cloud.provider
- cloud.region
- container.id
- host.name
- mssql.metrics.group_id
- mssql.metrics.name
- mssql.metrics.primary_replica
- mssql.metrics.server_name
- service.address
- gauge (3 fields):
- mssql.metrics.primary_recovery_health
- mssql.metrics.secondary_recovery_health
- mssql.metrics.synchronization_health
- routing_path (13 fields):
- agent.id
- cloud.account.id
- cloud.availability_zone
- cloud.instance.id
- cloud.provider
- cloud.region
- container.id
- host.name
- mssql.metrics.group_id
- mssql.metrics.name
- mssql.metrics.primary_replica
- mssql.metrics.server_name
- service.address
Index tsdb-index-enabled successfully created.
Copying documents from .ds-metrics-microsoft_sqlserver.availability_groups-default-2026.01.26-000001 to tsdb-index-enabled...
All 29 documents taken from index .ds-metrics-microsoft_sqlserver.availability_groups-default-2026.01.26-000001 were successfully placed to index tsdb-index-enabled.
| type: keyword | ||
| description: Server name of the current primary replica. | ||
| - name: synchronization_health | ||
| type: keyword |
There was a problem hiding this comment.
Update the field type to int type. Reference - link
| @@ -0,0 +1,31 @@ | |||
| metricsets: ["query"] | |||
| # Specify hosts in the below format. TODO: hosts need to be updated to support multiple entries. | |||
There was a problem hiding this comment.
This comment can be removed, its probably from beats
There was a problem hiding this comment.
Pull request overview
This PR adds a new data stream for monitoring Always On Availability Groups in Microsoft SQL Server, providing health and synchronization metrics for high availability configurations.
Changes:
- Added
availability_groupsdata stream with metrics for AG health, synchronization status, and replica recovery states - Updated package version from 2.15.0 to 2.16.0
- Added comprehensive documentation for the new data stream including prerequisites and field descriptions
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/microsoft_sqlserver/manifest.yml | Bumped package version to 2.16.0 |
| packages/microsoft_sqlserver/docs/README.md | Added documentation for availability_groups data stream with prerequisites and field reference |
| packages/microsoft_sqlserver/data_stream/availability_groups/sample_event.json | Provided sample JSON event showing AG metrics structure |
| packages/microsoft_sqlserver/data_stream/availability_groups/manifest.yml | Defined data stream configuration with TSDB index mode |
| packages/microsoft_sqlserver/data_stream/availability_groups/fields/fields.yml | Defined metric fields including dimensions and gauges for AG monitoring |
| packages/microsoft_sqlserver/data_stream/availability_groups/fields/ecs.yml | Configured ECS dimension fields for TSDB compatibility |
| packages/microsoft_sqlserver/data_stream/availability_groups/fields/base-fields.yml | Defined base data stream fields |
| packages/microsoft_sqlserver/data_stream/availability_groups/elasticsearch/ingest_pipeline/default.yml | Created ingest pipeline for processing AG metrics |
| packages/microsoft_sqlserver/data_stream/availability_groups/agent/stream/stream.yml.hbs | Defined SQL query template for collecting AG metrics |
| packages/microsoft_sqlserver/changelog.yml | Added changelog entry for version 2.16.0 |
| packages/microsoft_sqlserver/_dev/build/docs/README.md | Updated generated documentation with AG data stream information |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| **Prerequisites**: To collect Availability Groups metrics, ensure the following: | ||
|
|
||
| 1. Always On Availability Groups feature is enabled on the SQL Server instance. | ||
| 2. The user account configured for the integration has `VIEW SERVER STATE` and `VIEW ANY DEFINITION` permissions. *Additionaly look at secion [Microsoft SQL Server permissions](#microsoft-sql-server-permissions)*. |
There was a problem hiding this comment.
Corrected spelling of 'Additionaly' to 'Additionally' and 'secion' to 'section'.
| 2. The user account configured for the integration has `VIEW SERVER STATE` and `VIEW ANY DEFINITION` permissions. *Additionaly look at secion [Microsoft SQL Server permissions](#microsoft-sql-server-permissions)*. | |
| 2. The user account configured for the integration has `VIEW SERVER STATE` and `VIEW ANY DEFINITION` permissions. *Additionally look at section [Microsoft SQL Server permissions](#microsoft-sql-server-permissions)*. |
| **Prerequisites**: To collect Availability Groups metrics, ensure the following: | ||
|
|
||
| 1. Always On Availability Groups feature is enabled on the SQL Server instance. | ||
| 2. The user account configured for the integration has `VIEW SERVER STATE` and `VIEW ANY DEFINITION` permissions. *Additionaly look at secion [Microsoft SQL Server permissions](#microsoft-sql-server-permissions)*. |
There was a problem hiding this comment.
Corrected spelling of 'Additionaly' to 'Additionally' and 'secion' to 'section'.
| 2. The user account configured for the integration has `VIEW SERVER STATE` and `VIEW ANY DEFINITION` permissions. *Additionaly look at secion [Microsoft SQL Server permissions](#microsoft-sql-server-permissions)*. | |
| 2. The user account configured for the integration has `VIEW SERVER STATE` and `VIEW ANY DEFINITION` permissions. *Additionally look at section [Microsoft SQL Server permissions](#microsoft-sql-server-permissions)*. |
| # newer versions go on top | ||
| - version: "2.16.0" | ||
| changes: | ||
| - description: Add health metrics for Always On Availability Groups. |
There was a problem hiding this comment.
Remove trailing whitespace at the end of the description line.
| - description: Add health metrics for Always On Availability Groups. | |
| - description: Add health metrics for Always On Availability Groups. |
| title: "Microsoft SQL Server Always On Availability Groups metrics" | ||
| type: metrics | ||
| streams: | ||
| - input: sql/metrics |
There was a problem hiding this comment.
Can you add enabled:false flag, so that this datastream is not enabled by default for data collection?
💚 Build Succeeded
History
|
|
Package microsoft_sqlserver - 2.16.0 containing this change is available at https://epr.elastic.co/package/microsoft_sqlserver/2.16.0/ |

Proposed commit message
Add new data_stream for health metrics on Always On Availability Groups.
TSDB test
Checklist
changelog.ymlfile.Author's Checklist
How to test this PR locally
Related issues
Screenshots