Skip to content

Add metrics for account cache #1543

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

Merged
merged 1 commit into from
Oct 22, 2020
Merged

Conversation

laurb9
Copy link
Contributor

@laurb9 laurb9 commented Oct 14, 2020

Follow-up on #1519, issue #1395

Testing:
At server start:

$ curl -s http://localhost:8001/ | egrep ^account
account_cache_performance{cache_result="hit"} 0
account_cache_performance{cache_result="miss"} 0

After first request (publisher.id=valid_acct)

$ curl -s http://localhost:8001/ | egrep ^account
account_cache_performance{cache_result="hit"} 0
account_cache_performance{cache_result="miss"} 1
account_requests{account="valid_acct"} 1

After next 2 requests

$ curl -s http://localhost:8001/ | egrep ^account
account_cache_performance{cache_result="hit"} 2
account_cache_performance{cache_result="miss"} 1
account_requests{account="valid_acct"} 3

Testing:
At server start:
```
$ curl -s http://localhost:8001/ | egrep ^account
account_cache_performance{cache_result="hit"} 0
account_cache_performance{cache_result="miss"} 0
```

After first request
```
$ curl -s http://localhost:8001/ | egrep ^account
account_cache_performance{cache_result="hit"} 0
account_cache_performance{cache_result="miss"} 1
account_requests{account="valid_acct"} 1
```

After next 2 requests
```
$ curl -s http://localhost:8001/ | egrep ^account
account_cache_performance{cache_result="hit"} 2
account_cache_performance{cache_result="miss"} 1
account_requests{account="valid_acct"} 3
```
@laurb9 laurb9 force-pushed the account-cache-metrics branch from 7e10926 to e1a2550 Compare October 20, 2020 17:21
@laurb9
Copy link
Contributor Author

laurb9 commented Oct 20, 2020

Resolved conflicts with #1515 and rebased.

@SyntaxNode
Copy link
Contributor

Looks great. I just want to run locally and verify metric collection. I'll do that tomorrow.

Copy link
Contributor

@SyntaxNode SyntaxNode left a comment

Choose a reason for hiding this comment

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

Tested locally and looks good.

I realize that the cache miss counter continues to increase with an invalid account id. Beyond the scope of this PR, but we might want to consider adding a cache for invalid accounts too.

@bsardo
Copy link
Collaborator

bsardo commented Oct 22, 2020

LGTM. I would have preferred to have seen a pure UT in go_metrics_test.go but you've got the influx metrics engine coverage through metrics_test.go.

@bsardo bsardo merged commit 7b50f96 into prebid:master Oct 22, 2020
@laurb9 laurb9 deleted the account-cache-metrics branch October 22, 2020 19:01
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.

3 participants