-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Expose cache ttl for es span writer index+service #2737
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
cache ttl for es span writer index+service
Signed-off-by: Tyghe Vallard <vallardt@gmail.com> Signed-off-by: Tyghe Vallard <tyghe.vallard@target.com>
- Loading branch information
commit 715640a26f352a7ff6d2ef879981f31d251edcfb
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot check if a time.Duration is set or not since it would be 0, but you can check if a string is empty which is why I went the path I did there.
Anybody directly using the writer in their own code can use it and if later somebody wants to plumb in the ability for a flag for the apps to be able to set these could do that in a separate PR
I'm not sure how to test this since everything is in a private property and I cannot check if they are set in a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with 0? 0 is not a valid value for these parameters, so it works perfectly well as "unset" value.
Tests run in the private package namespace and can test those values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 is a valid value and would indicate caching forever so you still would not be able to differentiate from cache forever and not being set. Unless you want to assume that nobody would ever want to cache forever(which could be a valid thing, but I would rather be able to know for sure)
I did figure out how to test and just pushed those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, for the LRU cache that is used under the hood, the ttl=0 is a valid param. But in the context of the specific caching scenarios here (index and service names) I do not believe 0 is a valid value, because these caches grow over time. So we can use 0 as "undefined". If people want to cache "forever" they can still do it by providing a very long duration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I can make the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you really want to support "undefined" then the other alternative is to use a pointer.