Skip to content

Commit

Permalink
doc(UPM-2321): Document CNP metrics exposed by BigAnimal
Browse files Browse the repository at this point in the history
List the CNP metrics exposed by BigAnimal

Also provide some guidance on using those metrics and on the
structure of metrics and logs entries.

Note that this documentation change contains a section that is generated
by a script. The script is indended to be hosted in the upm-substrate
repo. It doesn't seem practical to add the script here and have it
re-generate the automatically generated section on every run, so
updating it is expected to be part of the BigAnimal release process for
now. A comment in the Markdown tries to direct the reader to where
the script lives.
  • Loading branch information
Craig Ringer authored and ringerc committed Nov 2, 2021
1 parent 9aab559 commit 9198a51
Show file tree
Hide file tree
Showing 2 changed files with 678 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,96 @@
title: "Monitoring and logging"
---

You can monitor your Postgres clusters by viewing the metrics and logs from Azure. For existing Postgres Enterprise Manager (PEM) users who wish to monitor EDB Cloud clusters alongside self-managed Postgres clusters, you can use the remote Remote Monitoring capability of PEM. For more information on using PEM to monitor your clusters see [Remote Monitoring](../../../../../pem/latest/pem_admin/02a_pem_remote_monitoring).
You can monitor your Postgres clusters by viewing the metrics and logs from
Azure.

The following sections describe viewing metrics and logs directly from Azure.
For existing Postgres Enterprise Manager (PEM) users who wish to monitor
BigAnimal clusters alongside self-managed Postgres clusters, you can use the
remote Remote Monitoring capability of PEM. For more information on using PEM
to monitor your clusters see
[Remote Monitoring](../../../../../pem/latest/pem_admin/02a_pem_remote_monitoring).

## Viewing metrics and logs from Azure
The following sections describes how to access logs and metrics directly in the
Azure portal.

EDB Cloud sends all metrics and logs from PostgreSQL clusters to Azure. The following describes what metrics and logs are sent and how to view them.
As every customer's needs are different, it is anticipated that applying Azure
Monitor features to the supplied data streams will enable customers to create
tailored insights into their workloads in order to better meet their business
goals.

### Azure log analytics
Pre-defined dashboards and metrics queries are provided in Azure Monitor as a
starting point for exploring the available data.

When BigAnimal deploys workloads on Azure, the logs from the PostgreSQL clusters are forwarded to the Azure Log Workspace.
To query BigAnimal logs, you must use [Azure Log Analytics](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-overview) and [Kusto Query language](https://azure-training.com/azure-data-science/the-kusto-query-language/).
## Viewing metrics and logs from Azure

BigAnimal sends all metrics and logs from Postgres clusters to Azure. The
following describes what metrics and logs are sent and how to view them.

### Azure Log Analytics

### Querying PostgreSQL cluster logs
When BigAnimal deploys workloads on Azure, the logs from the postgres
clusters are forwarded to the Azure Log Workspace.

A pre-defined shared dashboard panel in the Azure Portal shows recent postgres
logs. To query BigAnimal logs in more detail you must use
[Azure Log Analytics](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-overview)
and the
[Kusto Query language](https://azure-training.com/azure-data-science/the-kusto-query-language/).

All logs from your PostgreSQL clusters are stored in the _Customer Log Analytics workspace_. To find your _Customer Log Analytics workspace_:
### Using shared dashboards to view PostgreSQL cluster logs and metrics

1. Sign in to the [Azure portal](https://portal.azure.com).
To view logs and selected metrics summaries from your PostgreSQL clusters using
Shared Dashboard:

1. Sign in to the [Azure portal](https://portal.azure.com).
2. Select **Resource Groups**.
2. Select the Resource Group corresponding to the region where you choose to
deploy your BigAnimal cluster. You will see resources included in that
Resource Group.
3. Select the resource of type _Shared Dashboard_ with the suffix -customer.
4. Select the **Go to dashboard** link located at the top of the page.

2. Select the Resource Group corresponding to the region where you choose to deploy your BigAnimal cluster. You will see resources included in that Resource Group.
The default shared dashboard provided by BigAnimal will be extended and
enhanced over time. It includes panels for monitoring and diagnostic
information like:

3. Select the resource of type _Log Analytics workspace_ with the suffix -customer.
* Recent log entries for all clusters
* Row insert, update, and delete rates per database
* Query deadlock rates
* Connection counts over time
* Temporary storage use trend
* Replication lag
* Age of longest running transaction

!!! Important
Changes you make to the shared dashboard will be overwritten when
BigAnimal updates are deployed. Create your own custom dashboard if you wish to
modify or extend the provided dashboard. You can start with the BigAnimal dashboard
by using the "Clone" button in the dashboard view.
!!!

### Querying PostgreSQL cluster logs and metrics

All logs from your PostgreSQL clusters are stored in the _Customer Log
Analytics workspace_. To find your _Customer Log Analytics workspace_:

1. Sign in to the [Azure portal](https://portal.azure.com).
2. Select **Resource Groups**.
2. Select the Resource Group corresponding to the region where you choose to
deploy your BigAnimal cluster. You will see resources included in that Resource
Group.
3. Select the resource of type _Log Analytics workspace_ with the suffix -customer.
4. Select the Logs in the menu on the left in the General section.
5. Close the dashboard with pre-built queries. This will bring you to the KQL Editor.

5. Close the dashboard with prebuilt queries. This will bring you to the KQL Editor.
#### Available Logs and Metrics

The following tables are available in the _Customer Log Analytic workspace_.
See the next section [Metrics Details](#metrics-details-list) for a listing of
available metrics and details on the structure of log entries.

| Table name | Description | Logger |
| ---------- | ----------- | ------ |
| PostgresLogs_CL | Logs of the Customer clusters databases (all postgres related logs) | `logger = postgres` |
| PostgresAuditLogs_CL | Audit Logs of the Customer clusters databases | `logger = pgaudit or edb_audit` |
#### Example Log Queries

You can use the KQL Query editor to compose your queries over these tables. For example,
For example,

```
PostgresLogs_CL
Expand All @@ -59,18 +109,20 @@ PostgresAuditLogs_CL
| sort by record_log_time_s desc
```

### Using shared dashboards to view PostgreSQL cluster logs

To view logs from your PostgreSQL clusters using Shared Dashboard:

1. Sign in to the [Azure portal](https://portal.azure.com).

2. Select **Resource Groups**.
#### Example Metrics Queries

2. Select the Resource Group corresponding to the region where you choose to deploy your BigAnimal cluster. You will see resources included in that Resource Group.
To list the metrics from BigAnimal presently available in the `InsightsMetrics`
table use this query:

3. Select the resource of type _Shared Dashboard_ with the suffix -customer.
```
InsightsMetrics
| where Namespace == "prometheus"
| distinct Name
```

4. Select the **Go to dashboard** link located at the top of the page.
(Or just use Metrics Explorer).

### See also

* [Azure Monitor Metrics Overview](https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/data-platform-metrics)
Loading

1 comment on commit 9198a51

@ringerc
Copy link
Contributor

@ringerc ringerc commented on 9198a51 Sep 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script can be found attached to https://enterprisedb.atlassian.net/browse/UPM-2321

Please sign in to comment.