Error in retrieve the top N dimension keys for a metric

0

Dears,

I'm following the following documentation to be able to retrieve the Performance Insights metrics for Calls/sec and Rows examined/call Source: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/pi/client/describe_dimension_keys.html

And supported by the example in the following documentation: Source: https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_DescribeDimensionKeys.html

I am getting the following error:

Traceback (most recent call last):
  File "/Users/ricardogouvea/git/curso-rpa-python/pi_api/view.py", line 14, in <module>
    response = client.describe_dimension_keys(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ricardogouvea/git/curso-rpa-python/pi_api/venv/lib/python3.11/site-packages/botocore/client.py", line 534, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ricardogouvea/git/curso-rpa-python/pi_api/venv/lib/python3.11/site-packages/botocore/client.py", line 976, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidArgumentException: An error occurred (InvalidArgumentException) when calling the DescribeDimensionKeys operation: This metric is not a known metric: db.sql_tokenized.stats.calls_per_sec.avg

Process finished with exit code 1

Would anyone have an idea on how to resolve this? Best regards

  • Can you share the code triggering the error. A gentle note, code debugging is outside the scope of support. hence this is best effort basis.

rgouvea
asked 9 months ago322 views
3 Answers
0

Hi again,

From the request I didn't find any issue in the formatting or syntax based off of the boto3 documentation.

From the error you had indicated: This metric is not a known metric: db.sql_tokenized.stats.calls_per_sec.avg

The boto3 message suggests that this is not a valid metric. I can confirm that the metric is supported for DescribeDimensionKeys on the AWS API though I am unsure on boto3 as I do not have an environment with it.

I would recommend confirming if this metric is available on boto3 via their list_available_resource_metrics request. Linking again for ease of access: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/pi/client/list_available_resource_metrics.html

AWS
SUPPORT ENGINEER
answered 9 months ago
  • Hi Faustin,

    Thanks for the help, but I was in doubt, if the metric is available via the AWS API and boto3 may not recognize the metric, through which python lib could I access this API information? Could you guide me?

0

Hello rgouvea,

As mentioned by AWS-leevon, since code debugging is outside the scope of support, this is done on a best effort basis.

With that being said, if you could share the boto3 API request that this error originated from it would assist in narrowing the cause.

Additionally to ensure this metric is supported on boto3, you can use the following request for retrieving the possible metrics for Performance Insights: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/pi/client/list_available_resource_metrics.html

AWS
SUPPORT ENGINEER
answered 9 months ago
0

Of course, below is the code I'm using, but it's actually a reproduction of the code from the documentation itself mentioned above, in the message.

`from datetime import datetime import boto3

source_profile_name = 'da-prod' sourceRegion = 'us-east-1'

sSession = boto3.Session( profile_name=source_profile_name, region_name=sourceRegion )

client = sSession.client('pi')

response = client.describe_dimension_keys( ServiceType='RDS', Identifier='xx-XXXXXXXXXXXXXXXXXXXXXXXXX', StartTime=datetime(2023, 8, 2), EndTime=datetime(2023, 8, 2), Metric='db.load.avg', PeriodInSeconds=300, GroupBy={ 'Group': 'db.sql_tokenized', 'Dimensions': [ 'db.sql_tokenized.id', 'db.sql_tokenized.statement' ], 'Limit': 5 }, AdditionalMetrics=[ 'db.sql_tokenized.stats.calls_per_sec.avg', 'db.sql_tokenized.stats.rows_per_sec.avg' ], PartitionBy={ 'Group': 'db.user', 'Dimensions': [ 'db.user.id', 'db.user.name' ], 'Limit': 5 }, MaxResults=10 ) `

rgouvea
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions