-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
tracing: Support OpenTracing API #2017
Changes from all commits
773211e
e57a0fd
4af99ef
93ab508
ad4062a
739cd54
6270b3f
4e03f60
ab3db85
cee939f
c775ded
f1db61f
94750bd
1e255d4
725d002
961e195
ecf6df1
0803ff2
5d62c51
3ff6aaf
cc6a7e2
739bf4a
cf7896b
ce00ac6
861e87c
562746e
a9411ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -399,6 +399,29 @@ void HeaderMapImpl::iterateReverse(ConstIterateCb cb, void* context) const { | |
} | ||
} | ||
|
||
HeaderMap::Lookup HeaderMapImpl::lookup(const LowerCaseString& key, | ||
const HeaderEntry** entry) const { | ||
StaticLookupEntry::EntryCb cb = ConstSingleton<StaticLookupTable>::get().find(key.get().c_str()); | ||
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. Could we potentially have a findConst() or something which returns a ConstEntryCb so that we don't need the const_cast below? 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. Via a macro, each of the O(1) headers adds a lambda funtion that takes IMO const_cast is the better option. 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. I could go either way. I think it's slightly cleaner to have the init code add a const callback and then have a fineConst(), but I'm ok with this. I would just add a comment on the tradeoff. 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. Added comment for const_cast. 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. nit: For the next person that comes along and asks "why const_cast" can you add a brief additional comment on the tradeoffs between this and ^. 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. Added explanation for choosing const_cast. |
||
if (cb) { | ||
// The accessor callbacks for predefined inline headers take a HeaderMapImpl& as an argument; | ||
// even though we don't make any modifications, we need to cast_cast in order to use the | ||
// accessor. | ||
// | ||
// Making this work without const_cast would require managing an additional const accessor | ||
// callback for each predefined inline header and add to the complexity of the code. | ||
StaticLookupResponse ref_lookup_response = cb(const_cast<HeaderMapImpl&>(*this)); | ||
*entry = *ref_lookup_response.entry_; | ||
if (*entry) { | ||
return Lookup::Found; | ||
} else { | ||
return Lookup::NotFound; | ||
} | ||
} else { | ||
*entry = nullptr; | ||
return Lookup::NotSupported; | ||
} | ||
} | ||
|
||
void HeaderMapImpl::remove(const LowerCaseString& key) { | ||
StaticLookupEntry::EntryCb cb = ConstSingleton<StaticLookupTable>::get().find(key.get().c_str()); | ||
if (cb) { | ||
|
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.
This target is used to pre-build the dependencies when generating the Docker image. We still want to pre-build Lightstep and all its deps since they're pretty big.
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.
Fixed.