Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana unable to show RDS Postgres metrics #107

Open
vitorguidi opened this issue Nov 16, 2023 · 2 comments
Open

Grafana unable to show RDS Postgres metrics #107

vitorguidi opened this issue Nov 16, 2023 · 2 comments

Comments

@vitorguidi
Copy link

vitorguidi commented Nov 16, 2023

I am running grafana 10.2.0, and trying to collect metrics from cloudwatch. I am running RDS Postgres 12.14, and using the lambda from the monitoring-aurora-with-grafana folder.

I ran into a first issue, where this line of code would fail due to sending over 1000 data items:

    if metric_data:
        logger.info('## sending data to cloduwatch...')
        try:
            cw_client.put_metric_data(
            Namespace= targetMetricNamespace,
            MetricData= metric_data)
        except ClientError as error:
            raise ValueError('The parameters you provided are incorrect: {}'.format(error))

I then changed the code to split the put call in batches of 500, and it stopped happening:

result = []
    max_elements = 500
    for i in range(0, len(metric_data), max_elements):
        result.append(metric_data[i:i + max_elements])
    
    if metric_data:
        for entry in result:
            logger.info('## sending data to cloduwatch...')
            try:
                cw_client.put_metric_data(
                Namespace= targetMetricNamespace,
                MetricData= entry)
            except ClientError as error:
                raise ValueError('The parameters you provided are incorrect: {}'.format(error))

After this, it started erroring out from the db_slices LoC:

dbSliceGroup = { "db.sql_tokenized", "db.application", "db.wait_event", "db.user", "db.session_type", "db.host", "db", "db.application" }

I got some exceptions from the lambda, where initially db.session_type was considered invalid. Then a couple others which I did not take note also failed. I then commented everything out, to remain only with db.sql_tokenized:

dbSliceGroup = { 
    "db.sql_tokenized", 
    #"db.application", 
    #"db.wait_event", 
    #"db.user", 
    #"db.session_type", 
    #"db.host", 
    #"db", 
    #"db.application" 
}

Things then worked out and I managed to see the metrics in the AuroraMonitoringGrafana/PerformanceInsightMetrics namespace. Unfortunately though, the metrics do not show up in Grafana, despite me adding the custom namespaces in configs. I am using the dashboard included in this repo, for the aurora use case.

Is there any subtlety involved, to make these metrics work? I do not know where to look further, some assistance would be appreciated.

image image
@vitorguidi
Copy link
Author

Some extra information: whenever I perform a query on cloudwatch via boto3, the metrics in a custom namespace are not returned, despite there being metrics (as showed previously in the cloudwatch ui). Nonetheless, whenever we query an AWS namespace (ie, AWS/Athena), I get a non empty response.

This points to a possible issue in the way the cloudwatch API is being queried, as far as custom namespaces go

@vitorguidi
Copy link
Author

vitorguidi commented Nov 17, 2023

Figured that one out => I was unable to query the CloudWatch api (through boto3) with the AuroraMonitoringGrafana/PerformanceInsightMetrics namespace. I switched to grafana/rds and it worked just fine.

Lastly, I added the dimensions to the tokenized_sql query (db.tokenized_sql.id and db.tokenized_sql.db_id) and it did the trick.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant