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

Census Tag Set API and implementation #4750

Merged
merged 16 commits into from
Jan 22, 2016
Prev Previous commit
Next Next commit
comment updates
  • Loading branch information
a-veitch committed Jan 20, 2016
commit 8e5b21fd9faf0b1ba2f74e88fe7e59bc3d5ed299
10 changes: 7 additions & 3 deletions include/grpc/census.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ typedef struct {
} census_tag_set_create_status;

/* Create a new tag set, adding and removing tags from an existing tag set.

Choose a reason for hiding this comment

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

Please explain the fact that the current implementation copies all the tags and is recommended to do bulk add/remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

This will copy all tags from it's input parameters, so it is recommended
to add as many tags in a single operation as is practical for the client.
@param base Base tag set to build upon. Can be NULL.
@param tags A set of tags to be added/changed/deleted. Tags with keys that
are in 'tags', but not 'base', are added to the tag set. Keys that are in
Expand All @@ -385,8 +387,10 @@ typedef struct {
binary or non-binary tags, they will be ignored, as will deletions of
tags that don't exist.
@param ntags number of tags in 'tags'
@param stats Information about the tag set created and actions taken during
its creation.
@param status If not NULL, the pointed to structure will be filled in with
information about the new tag set and status of the tags used in its
creation.
@return A new, valid census_tag_set.
*/
census_tag_set *census_tag_set_create(const census_tag_set *base,
const census_tag *tags, int ntags,
Expand All @@ -396,7 +400,7 @@ census_tag_set *census_tag_set_create(const census_tag_set *base,
has been called, the tag set cannot be reused. */
void census_tag_set_destroy(census_tag_set *tags);

/* Get the number of tags in the tag set. */
/* Get the total number of tags in the tag set. */
int census_tag_set_ntags(const census_tag_set *tags);

/* Structure used for tag set iteration. API clients should not use or
Expand Down
3 changes: 2 additions & 1 deletion src/core/census/tag_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
// are to aid in efficient parsing and the ability to directly return key
// strings. This is more important than saving a single byte/tag on the wire.
// * The wire encoding uses only single byte values. This eliminates the need
// to handle endian-ness conversions.
// to handle endian-ness conversions. It also means there is a hard upper
// limit of 255 for both CENSUS_MAX_TAG_KV_LEN and CENSUS_MAX_PROPAGATED_TAGS.
// * Keep all tag information (keys/values/flags) in a single memory buffer,
// that can be directly copied to the wire. This makes iteration by index

Choose a reason for hiding this comment

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

We don't have the iteration by index anymore. Consider to remove this concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

// somewhat less efficient. If it becomes a problem, we could consider
Expand Down