-
Notifications
You must be signed in to change notification settings - Fork 97
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
fix: make sure decision keep and drop is persisted in redis #1020
fix: make sure decision keep and drop is persisted in redis #1020
Conversation
In order to persist the the decisionDrop for a given trace, this commit makes sure we are following the same state transition pattern as other state events for DecisionDrop. When a trace is marked as dropped, span information is also deleted.
Utilize SetNXHash to set KeepReason only once. This change also does proper state transition for decisionKeep.
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.
Some nits, but otherwise cool.
centralstore/smartwrapper_test.go
Outdated
@@ -330,7 +331,7 @@ func TestSetTraceStatuses(t *testing.T) { | |||
if status.TraceID == traceids[0] { | |||
assert.Equal(t, DecisionKeep, status.State) | |||
// TODO: save the reason in the reason cache correctly |
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.
remove this TODO, please
internal/redis/redis.go
Outdated
} | ||
} | ||
|
||
// TODO: values is always "OK", but we should be able to get the 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.
I don't understand what this TODO is saying?
centralstore/smartwrapper_test.go
Outdated
@@ -433,14 +434,14 @@ func BenchmarkStoreGetTracesForState(b *testing.B) { | |||
} | |||
} | |||
|
|||
func cleanupRedisStore(store BasicStorer) error { | |||
func cleanupRedisStore(t testing.TB, store BasicStorer) error { |
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.
Given that you're logging and not returning an error, should probably remove the return parameter.
abb6333
to
aa3df08
Compare
The score in a sorted set is a float64. Nanosecond can't fit into a float64. That's why we are changing it to microsecond.
aa3df08
to
9e63c53
Compare
<!-- Thank you for contributing to the project! 💜 Please make sure to: - Chat with us first if this is a big change - Open a new issue (or comment on an existing one) - We want to make sure you don't spend time implementing something we might have to say No to - Add unit tests - Mention any relevant issues in the PR description (e.g. "Fixes #123") Please see our [OSS process document](https://github.com/honeycombio/home/blob/main/honeycomb-oss-lifecycle-and-practices.md#) to get an idea of how we operate. --> ## Which problem is this PR solving? Before this PR, decisions made for traces were not stored in redis. It also wasn't part of the state machine when transition a trace from awaiting for decision to either decision keep or drop. ## Short description of the changes - Introduced DecisionDrop and DecisionKeep into the state machine - check against in-memory cache before fetching from Redis for trace status - run smartwrapper tests against redis in the ci - removed some unnecessary code
<!-- Thank you for contributing to the project! 💜 Please make sure to: - Chat with us first if this is a big change - Open a new issue (or comment on an existing one) - We want to make sure you don't spend time implementing something we might have to say No to - Add unit tests - Mention any relevant issues in the PR description (e.g. "Fixes #123") Please see our [OSS process document](https://github.com/honeycombio/home/blob/main/honeycomb-oss-lifecycle-and-practices.md#) to get an idea of how we operate. --> ## Which problem is this PR solving? Before this PR, decisions made for traces were not stored in redis. It also wasn't part of the state machine when transition a trace from awaiting for decision to either decision keep or drop. ## Short description of the changes - Introduced DecisionDrop and DecisionKeep into the state machine - check against in-memory cache before fetching from Redis for trace status - run smartwrapper tests against redis in the ci - removed some unnecessary code
<!-- Thank you for contributing to the project! 💜 Please make sure to: - Chat with us first if this is a big change - Open a new issue (or comment on an existing one) - We want to make sure you don't spend time implementing something we might have to say No to - Add unit tests - Mention any relevant issues in the PR description (e.g. "Fixes #123") Please see our [OSS process document](https://github.com/honeycombio/home/blob/main/honeycomb-oss-lifecycle-and-practices.md#) to get an idea of how we operate. --> ## Which problem is this PR solving? Before this PR, decisions made for traces were not stored in redis. It also wasn't part of the state machine when transition a trace from awaiting for decision to either decision keep or drop. ## Short description of the changes - Introduced DecisionDrop and DecisionKeep into the state machine - check against in-memory cache before fetching from Redis for trace status - run smartwrapper tests against redis in the ci - removed some unnecessary code
<!-- Thank you for contributing to the project! 💜 Please make sure to: - Chat with us first if this is a big change - Open a new issue (or comment on an existing one) - We want to make sure you don't spend time implementing something we might have to say No to - Add unit tests - Mention any relevant issues in the PR description (e.g. "Fixes #123") Please see our [OSS process document](https://github.com/honeycombio/home/blob/main/honeycomb-oss-lifecycle-and-practices.md#) to get an idea of how we operate. --> ## Which problem is this PR solving? Before this PR, decisions made for traces were not stored in redis. It also wasn't part of the state machine when transition a trace from awaiting for decision to either decision keep or drop. ## Short description of the changes - Introduced DecisionDrop and DecisionKeep into the state machine - check against in-memory cache before fetching from Redis for trace status - run smartwrapper tests against redis in the ci - removed some unnecessary code
<!-- Thank you for contributing to the project! 💜 Please make sure to: - Chat with us first if this is a big change - Open a new issue (or comment on an existing one) - We want to make sure you don't spend time implementing something we might have to say No to - Add unit tests - Mention any relevant issues in the PR description (e.g. "Fixes #123") Please see our [OSS process document](https://github.com/honeycombio/home/blob/main/honeycomb-oss-lifecycle-and-practices.md#) to get an idea of how we operate. --> ## Which problem is this PR solving? Before this PR, decisions made for traces were not stored in redis. It also wasn't part of the state machine when transition a trace from awaiting for decision to either decision keep or drop. ## Short description of the changes - Introduced DecisionDrop and DecisionKeep into the state machine - check against in-memory cache before fetching from Redis for trace status - run smartwrapper tests against redis in the ci - removed some unnecessary code
…bio#1020) <!-- Thank you for contributing to the project! 💜 Please make sure to: - Chat with us first if this is a big change - Open a new issue (or comment on an existing one) - We want to make sure you don't spend time implementing something we might have to say No to - Add unit tests - Mention any relevant issues in the PR description (e.g. "Fixes honeycombio#123") Please see our [OSS process document](https://github.com/honeycombio/home/blob/main/honeycomb-oss-lifecycle-and-practices.md#) to get an idea of how we operate. --> ## Which problem is this PR solving? Before this PR, decisions made for traces were not stored in redis. It also wasn't part of the state machine when transition a trace from awaiting for decision to either decision keep or drop. ## Short description of the changes - Introduced DecisionDrop and DecisionKeep into the state machine - check against in-memory cache before fetching from Redis for trace status - run smartwrapper tests against redis in the ci - removed some unnecessary code
Which problem is this PR solving?
Before this PR, decisions made for traces were not stored in redis. It also wasn't part of the state machine when transition a trace from awaiting for decision to either decision keep or drop.
Short description of the changes