Add rds multitenant module - #381
Conversation
- Update Athena tables to match actual S3 data partitioning structure - Add payer_id and region partition keys to support multi-account data - Configure Parquet SerDe for proper data format handling - Remove predefined Glue tables, let crawlers auto-discover schema - Add hourly_ prefix to separate crawler table creation - Update pi_data_view to reference hourly_rds_multitenant table - Update deployment templates to support RDS multitenant module
- Add engine detection to skip database dimension for Oracle/SQL Server - Collect db.load metrics by both user and database dimensions - Add dimension_type field to distinguish between user and database metrics - Fix Parquet field names to use underscores instead of dots for valid column names - Update Athena view to handle both dimension types with proper CASE statements - Fix view JOIN order to prevent row duplication - Maintain backward compatibility with existing data structure
- Add engine field to collected metrics data - Update process_metrics function to accept engine parameter - Include engine column in Athena view for filtering and analysis - Enable cost allocation analysis by database engine type
|
|
||
|
|
||
|
|
||
| GlueServiceRole: |
There was a problem hiding this comment.
We have a common glue role. Please use that.
| - s3:PutObject | ||
| Resource: !Sub "${DestinationBucketARN}/*" | ||
|
|
||
| PerformanceInsightsRDSCrawler: |
There was a problem hiding this comment.
the patttern is to run crawler in step function that we have already. please check other modules
| - !Sub "${DestinationBucketARN}" | ||
| - !Sub "${DestinationBucketARN}/*" | ||
|
|
||
| CreateAthenaViewsLambda: |
There was a problem hiding this comment.
This make sense to create this on higher level so that all modules could run athena queries as custom resources.
| 'Data': response_data | ||
| } | ||
|
|
||
| http = urllib3.PoolManager() |
There was a problem hiding this comment.
use cfnrequest lib
|
|
||
|
|
||
|
|
||
| GlueDatabaseName: |
| # Convert to Arrow table | ||
| table = pa.Table.from_pylist(grouped_metrics) | ||
|
|
||
| # Write to Parquet format |
There was a problem hiding this comment.
do we need to write to parquert format? Why not just json? Surely not as performant but no dependency needed
| except Exception as e: | ||
| logger.error(f"Error processing DB instance {db_instance['DBInstanceIdentifier']}: {str(e)}") | ||
|
|
||
| # Handle pagination |
There was a problem hiding this comment.
you can make it simplier with simple paginators
for db_instance in rds_client.get_paginator('describe_db_instances').paginate().search('DBInstances'):
| 'body': 'Athena views created successfully' | ||
| } | ||
|
|
||
| def create_workgroup_if_not_exists(athena_client, workgroup_name): |
There was a problem hiding this comment.
i do not think we should create resources that are supported by CFN in lambda.
- Add CloudWatch Database Insights for multi-tenant cost allocation to main README - Update data-collection README with comprehensive RDS multitenant module documentation - Use correct CloudWatch Database Insights terminology (replacing deprecated Performance Insights naming) - Include module details, supported engines, key features, and prerequisites
- Add docstrings to all Lambda functions explaining their purpose - Document multi-tenant cost allocation logic and dimension types - Explain engine compatibility limitations for Oracle/SQL Server - Add CloudFormation template comments for key resources - Document S3 partitioning strategy and Parquet storage optimization - Improve code maintainability and understanding
- Update Lambda function to use REGIONS_IN_SCOPE environment variable - Fallback to all regions if parameter is empty - Improves performance by limiting data collection to specified regions
- Remove else branch that queries all AWS regions when RegionsInScope is empty - Function now processes empty list when no regions specified - Simplifies logic and prevents unintended region scanning
- Align version with original repository
- Add Glue table definition for hourly_rds_multitenant with correct schema - Add glue:GetDatabases permission to AthenaViewsLambdaRole - Add conditional view creation to handle missing table gracefully - Update table references from rds_multitenant to hourly_rds_multitenant - Include all required columns: engine, dimension_type, db_user_name, db_database_name
…module Enhances the existing RDS Multi-Tenant module with configurable Performance Insights dimensions and API pagination support for improved data collection flexibility and completeness. Key Enhancements: - Added configurable dimensions via DimensionsToTrack parameter (user, database, host, sql, waits) - Implemented pagination for Performance Insights API to handle >25 results per dimension - Uses tokenized SQL queries (db.sql_tokenized) for better query pattern aggregation - Engine-specific dimension filtering (e.g., database not supported on Oracle/SQL Server) - Default tracks all dimensions: user,database,host,sql,waits Changes: - data-collection/deploy/module-rds-multitenant.yaml: * Added DimensionsToTrack parameter with validation pattern * Implemented DIMENSION_CONFIG dictionary for dimension management * Added pagination loop in get_performance_metrics() to fetch all results * Updated dimension detection to support db.sql_tokenized fields * Added is_dimension_supported() function for engine compatibility checks - data-collection/deploy/deploy-data-collection.yaml: * Updated RDS multitenant module template URL reference - data-exports/README.md: * Added comprehensive beta deployment documentation * Step-by-step deployment guide with manual instructions * Data schema and cost allocation query examples * Engine compatibility matrix * Known limitations and troubleshooting guide - .gitignore: * Added patterns for test scripts and temporary files Technical Details: - Pagination ensures all dimension values are captured (not limited to 25) - Tokenized SQL groups similar queries for better analysis - Engine compatibility automatically enforced based on AWS documentation - Backward compatible: existing deployments continue to work
Moved the RDS Multi-Tenant module beta deployment documentation from data-exports/README.md to data-collection/README.md where it belongs, as it's a data collection module.
Restored data-exports/README.md to the original version from main branch, removing the RDS Multi-Tenant documentation that was incorrectly added there.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.