Skip to content
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

Add keys method to extractors #209

Merged
merged 4 commits into from
Sep 4, 2020
Merged

Add keys method to extractors #209

merged 4 commits into from
Sep 4, 2020

Conversation

craigpastro
Copy link
Contributor

First attempt at #195. I could probably use some help with the documentation though 🙇

Closes #195.

@craigpastro craigpastro requested a review from a team September 3, 2020 02:30
@jtescher
Copy link
Member

jtescher commented Sep 3, 2020

@siyopao great start! What do you think about having keys return an iterator over &strs instead of a Vec? Could help people avoid the additional allocation.

@craigpastro
Copy link
Contributor Author

Thanks for the comment @jtescher. Good idea! I've updated to return an iterator.

@jtescher
Copy link
Member

jtescher commented Sep 3, 2020

@siyopao Sorry I hadn't looked into this closely enough, I don't think we can have this be an iterator without additional allocations as the lifetimes for something like &dyn Iterator<Item=&str> can't be easily resolved. @TommyCpp any clever ideas here? If not then the original Vec<&str> is probably the better return type here.

@TommyCpp
Copy link
Contributor

TommyCpp commented Sep 3, 2020

@siyopao Sorry I hadn't looked into this closely enough, I don't think we can have this be an iterator without additional allocations as the lifetimes for something like &dyn Iterator<Item=&str> can't be easily resolved.

I agree. There is no guarantee how extractors will store those keys. So we may as well use Vec

@craigpastro
Copy link
Contributor Author

No worries. Reverted that commit.

Copy link
Member

@jtescher jtescher left a comment

Choose a reason for hiding this comment

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

Ok looks good 👍

@jtescher jtescher merged commit de4ff0c into open-telemetry:master Sep 4, 2020
@craigpastro craigpastro deleted the add-keys-method branch September 6, 2020 08:32
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.

Add keys method to extractors
3 participants