Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Add tags package based on the specs. #172

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bogdandrutu
Copy link
Contributor

@bogdandrutu bogdandrutu commented Jan 16, 2019

Copy link
Contributor

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@rghetia rghetia left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

Perhaps I'm out of context for the motivation here. Added couple of comments

src/opencensus/proto/tags/v1/tags.proto Outdated Show resolved Hide resolved
// each key is associated with exactly one value.
message TagMap {
// Not a map becuase the proto3 map does not allow a message as the key.
repeated Tag tags = 1;
Copy link
Member

Choose a reason for hiding this comment

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

so tags with the same name is allowed, correct? Perhaps something should be said about it in comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The list should contains unique TagKeys. The proto3 map does not allow the map_key to be a proto message see https://developers.google.com/protocol-buffers/docs/proto3#maps.

Copy link
Member

Choose a reason for hiding this comment

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

The fact that the same key value is not allowed is not clear from the comment at all. As minimum I suggest to indicate this requirement in a comment.

Copy link
Member

Choose a reason for hiding this comment

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

From my perspective - compromising on data integrity by not forcing uniqueness of keys in favor of potential extensibility sounds a hard sell in this case. Do you see a scenario in which key will be typed? Any other information like PII flag may be moved to the value. Or I am missing something?

Copy link
Member

Choose a reason for hiding this comment

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

BTW, map with the string key is used for Attributes already. Arguably Attributes keys should have all the same scenarios as tags.

Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify - some misunderstanding may be coming from how you can read the sentence "each key is associated with exactly one value.". If you treat "each key" as unique string - it is already handled. But I read it as one key object maps to one value object. I see you already handled it, just clarifying what I meant,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason of using a TagKey instead of directly string is because few reasons:

  1. Later we can make the TagKey { oneof (string, int) } where int may represent a global id if you have a global registry for all the tags.
  2. For the string in TagKey we need to do validation (limited char set) so this way people can create the key once and avoid validation every time in the api.

// It MUST contain only printable ASCII (codes between 32 and 126)
//
// This field is required.
string value = 1;
Copy link
Member

Choose a reason for hiding this comment

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

why not truncatable string? If it is not a truncatable string - what's the reason to have a message for it and not simply use string as before? Same comment for TagKey

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason to have a message:

  1. For the tag key in the future we may add other things - e.g. type information (string, int, etc.) or any other metadata.
  2. For the tag value in the future we may support other types like int.

Copy link
Member

Choose a reason for hiding this comment

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

I got why we need a message for TagValue. This comment is more about the fact that there is no consistency in current proto definitions on whether string or TruncatableString is used. Or I am missing something. AttributeValue and Span name uses TruncatableString whereas Status and Tracestate uses string. So my question is what's the deciding factor here of whether to use one or another

@bogdandrutu
Copy link
Contributor Author

// * MUST not be empty.
//
// This field is required.
string value = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be like -> string name = 1;

// TagValue is the value associated with a Tag.
message TagValue {
// It MUST contain only printable ASCII (codes between 32 and 126)
//
Copy link
Member

Choose a reason for hiding this comment

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants