awslabs / aws-athena-query-federation

The Amazon Athena Query Federation SDK allows you to customize Amazon Athena with your own data sources and code.
Apache License 2.0
560 stars 297 forks source link

[FEATURE] Enable CloudWatch Metrics Connector to support metrics shared with Observability Access Manager #1333

Open gfawcett22 opened 1 year ago

gfawcett22 commented 1 year ago

Is your feature request related to a problem? If yes, please describe. CloudWatch supports the sharing of metrics via the Observability Access Manager API. This enables a monitoring account to view metrics from other accounts. To support this, the ListMetrics API call must include the IncludeLinkedAccounts parameter set to true. Additionally, the response includes an OwningAccounts array which corresponding to the owning accounts of the metrics listed. I was able to include the shared metrics by changing this line to ListMetricsRequest listMetricsRequest = new ListMetricsRequest().withIncludeLinkedAccounts(true); however I'm not sure where this parameter should be set. Additionally, the output doesn't include the owning account.

Describe the solution you'd like Make the IncludeLinkedAccounts parameter configurable and ideally include the owning account in the output.

Describe alternatives you've considered N/A. AWS Support has suggested creating an Athena data source in each account but with hundreds of accounts this is not feasible as data sources are not supported by CloudFormation.

anhtranquang commented 8 months ago

Hi, anyone looking into this yet? Or anyone has any alternatives to query cross account metrics in Athena please share?

atennak1 commented 3 months ago

I've implemented this in my own clone. Feel free to use it. We're actively using it for a QuickSight dashboard and it seems to work for us, but I can't guarantee it's bug free. I'll clean it up, add unit tests, and open a PR when I have the time.