8000 User-Agents analytics for developer endpoints by giograno · Pull Request #11855 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

User-Agents analytics for developer endpoints #11855

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

giograno
Copy link
Member

Motivation

As we are introducing SDKs to interact with LocalStack endpoints, we want to gather some analytics about their usage.
My idea was to use one UsageSetCounter for each endpoint and count the unique occurrences of the User-Agents.
A namespace would be internal:<path> and the record would happen in the open API request validation handler (even if the validation is not active).

Looking for feedback about this approach. For instance, does it make sense to log all agents? Would this generate too much data?

Changes

  • Adding analytics counters for the user agents of internal endpoints.

@giograno giograno added the semver: patch Non-breaking changes which can be included in patch releases label Nov 15, 2024
@giograno giograno added this to the 4.0 milestone Nov 15, 2024
@giograno giograno self-assigned this Nov 15, 2024
Copy link
github-actions bot commented Nov 15, 2024

LocalStack Community integration with Pro

    2 files  ± 0      2 suites  ±0   1h 43m 36s ⏱️ -53s
3 552 tests +24  3 145 ✅ +10  407 💤 +14  0 ❌ ±0 
3 554 runs  +24  3 145 ✅ +10  409 💤 +14  0 ❌ ±0 

Results for commit a81ae8b. ± Comparison against base commit fd33d31.

♻️ This comment has been updated with latest results.

@giograno giograno marked this pull request as ready for review November 15, 2024 10:26
@giograno giograno requested a review from thrau as a code owner November 15, 2024 10:26
Copy link
Contributor
@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

Nice, having a global way of doing this would be really great.

I have a few comments regarding adding this to all internal routes without discrimination, as API Gateway would get caught into it as well. Maybe adding it to the _aws namespace wasn't such a good idea after all 😕

I believe this PR is counting every requests coming to LocalStack.

Also, we might need some more granularity in the different routes, for example in API Gateway with #11860, we count requests depending on their integration type (AWS, AWS_PROXY, etc).

I could see something similar to this PR if the internal routes could add metadata to the RequestContext, but they don't have access to it... 😭

@giograno giograno marked this pull request as draft November 18, 2024 19:27
@giograno giograno force-pushed the analytics-internal-endpoints branch from cd06d1a to 038e0ea Compare November 18, 2024 23:56
@giograno giograno force-pushed the analytics-internal-endpoints branch from 038e0ea to d8bfa32 Compare November 19, 2024 00:05
@giograno giograno requested a review from bentsku November 19, 2024 01:29
@giograno giograno marked this pull request as ready for review November 19, 2024 01:29
Copy link
Contributor
@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

This looks good to me! Just the question of the location of the code remains, to me this is not really blocking but should probably be addressed in a follow-up, as we are bit pressed for time. Just would like a confirmation before approving/merging.

I think this solution is good for now, allowing us to still understand usage with not too much granularity. Very good idea to track at a global level 👌

Copy link

S3 Image Test Results (AMD64 / ARM64)

  2 files  ±0    2 suites  ±0   4m 32s ⏱️ +38s
421 tests ±0  369 ✅ ±0   52 💤 ±0  0 ❌ ±0 
842 runs  ±0  738 ✅ ±0  104 💤 ±0  0 ❌ ±0 

Results for commit a81ae8b. ± Comparison against base commit fd33d31.

Copy link
Contributor
@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for creating a dedicated handler, already living in analytics.py, this is clean 👌

@thrau thrau modified the milestones: 4.0, 4.1, Playground Nov 20, 2024
@thrau
Copy link
Member
thrau commented Nov 20, 2024

hey folks! i changed the milestone on this one, as i'd like to discuss this change more, and we won't get this in on time until 4.0. as ben pointed out, there's no real rush. will follow up post-v4 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0