Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template updates for Frequency Capping #784

Merged
merged 6 commits into from
Oct 30, 2024
Merged

Template updates for Frequency Capping #784

merged 6 commits into from
Oct 30, 2024

Conversation

kookster
Copy link
Member

@kookster kookster commented Sep 22, 2024

  • Analytics Lambda
  • Dovetail Router

- dynamodb:DescribeTable
- dynamodb:DescribeTimeToLive
- dynamodb:GetItem
- dynamodb:Query
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DTR should only need to read data, no write/update/delete actions

@kookster kookster requested review from cavis and farski October 1, 2024 18:59
spire/templates/apps/dovetail-analytics.yml Outdated Show resolved Hide resolved
- dynamodb:GetItem
- dynamodb:Query
Effect: Allow
Resource: !Split
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This split/sub/join/split insanity was only needed for a short time when the arrangements table was being moved from a regional table to a global table, and we were accessing both. I don't believe that's the case any more.

So for this I would either simplify this back to a single !Ref, or probably FrequencyDynamodbTableName should to be renamed to something that indicates that it can/does contain multiple table names

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, I made it consistent with the other DDB tables, but I can simplify it as there is only one table

Threshold: 0
TreatMissingData: notBreaching

AnalyticsFrequencyFunctionInsertsMetricFilter:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metrics generated by these next few metric filters don't seem to be used anywhere. Do we want to put them on a dashboard or alarm on them? Or are they just for reference purposes, should the need arise?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the other lambdas in this template, I created equivalent metrics to what they had defined.
Is there someplace else I need to add these, some other dashboard template I don't remember?

AlarmName: !Sub WARN [Dovetail-Analytics] Frequency Lambda function <${EnvironmentTypeAbbreviation}> INVOCATIONS ERRORS (${RootStackName})
AlarmDescription: !Sub >-
${EnvironmentType} Dovetail Analytics Frequency Lambda function is
failing, but tktktk.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tktktk

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, copied from other alarms in the same file with the same tktktk description

- dynamodb:UpdateItem
Effect: Allow
# TODO: can this be done with an AWS::Partition Sub?
Resource: !Split
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other comment about this split/sub/join stuff

@@ -152,6 +152,8 @@ Resources:
DovetailCountedKinesisStreamName: !Ref DovetailCountedKinesisStreamName
DovetailRouterHosts: !Sub /prx/${EnvironmentTypeAbbreviation}/dovetail-analytics/DOVETAIL_ROUTER_HOSTS
DovetailRouterApiTokens: !Sub /prx/${EnvironmentTypeAbbreviation}/dovetail-analytics/DOVETAIL_ROUTER_API_TOKENS
FrequencyDynamodbTableName: !Sub /prx/${EnvironmentTypeAbbreviation}/dovetail-analytics/FREQUENCY_DDB_TABLE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Parameter Store parameters are using a naming convention that predates the current standard, and the few parameters that remain from back then are slated to be cleaned up.

It would be ideal if we didn't add any new parameters that don't follow the current standard, but if it makes more sense to deal with this later, let's make sure they at least get added to that issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, for this ddb, it will be a global table like the arrangements DDB table, so I don't believe it needs the optional region, I will add Spire in there

- !Split [",", !Ref FrequencyDynamodbTableName]
- Action: sts:AssumeRole
Effect: Allow
Resource: !Split [",", !Ref FrequencyDynamodbAccessRoleArn]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar situation here: I believe we expect this to be a single role ARN now, so no need to Split.

@@ -739,6 +741,25 @@ Resources:
Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
- Action:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement needs to go under Policies, not the AssumePolicyDocument. See https://github.com/PRX/Infrastructure/blob/main/spire/templates/apps/feeder.yml#L599 for an example

@kookster kookster requested a review from farski October 16, 2024 18:34
@kookster kookster merged commit f2647e0 into main Oct 30, 2024
4 checks passed
@kookster kookster deleted the feat/dt-freq-cap branch October 30, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants