Skip to content

Commit

Permalink
feat(tag-filtering): enable tag filtering metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel committed Nov 21, 2024
1 parent 83de97e commit 2adc89b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,16 @@ def query_aws_cost_explorer(self, aws_client, group_by, tag_filters=None):
# Include tag filters if provided
if tag_filters:
tag_filter_list = []
for tag_key, tag_values in tag_filters.items():
tag_filter = {
"Tags": {
"Key": tag_key,
"Values": tag_values,
"MatchOptions": ["EQUALS"] # Adjust as needed
}
for tag_filter in tag_filters:
tag_key = tag_filter["tag_key"]
tag_values = tag_filter["tag_values"]
tag_filter_list.append({
"Tags": {
"Key": tag_key,
"Values": tag_values,
"MatchOptions": ["EQUALS"]
}
tag_filter_list.append(tag_filter)
})

# Combine the base filter and tag filters using 'And'
combined_filter = {
Expand Down

0 comments on commit 2adc89b

Please sign in to comment.