-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Do not exceed ES _id length limit #905
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
Changes from all commits
6f43001
3489723
10fcf67
762c739
658cec6
3d46c8a
8e909f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ package spanstore | |
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "hash/fnv" | ||
| "strconv" | ||
| "strings" | ||
| "time" | ||
|
|
@@ -73,6 +75,13 @@ type Span struct { | |
| StartTimeMillis uint64 `json:"startTimeMillis"` | ||
| } | ||
|
|
||
| func (s Service) hashCode() string { | ||
| h := fnv.New64a() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can this be cached? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @black-adder It could be but it will introduce issue with concurrency. Every simultaneous call to this function would potentially cause race condition and would render unpredictable hash results. I would need to introduce some kind of semaphore and mark this part as critical section. Do you think it is worth?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. @black-adder so my reasoning is like this.
I did actually run into this issue while fixing the tests :-) Even if I introduce I hope this helps. |
||
| h.Write([]byte(s.ServiceName)) | ||
| h.Write([]byte(s.OperationName)) | ||
| return fmt.Sprintf("%x", h.Sum64()) | ||
| } | ||
|
|
||
| // NewSpanWriter creates a new SpanWriter for use | ||
| func NewSpanWriter( | ||
| client es.Client, | ||
|
|
||
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'm not a big fan of using the same hash function here to test that the service was hashed, I'd prefer if you generated this hash once and compare against the actual hash string.
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've removed calls to
hashCode()and put static hash in those tests.