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
질문됨 10달 전336회 조회
3개 답변
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
지원 엔지니어
답변함 9달 전
  • 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
지원 엔지니어
답변함 9달 전
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
답변함 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠