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

Support nested Attribute values (#376) #596

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,9 @@ An `Attribute` is defined by the following properties:
- (Required) The attribute key, which MUST be a non-`null` and non-empty string.
- (Required) The attribute value, which is either:
- A primitive type: string, boolean or numeric.
- An array of primitive type values. The array MUST be homogeneous,
i.e. it MUST NOT contain values of different types.
- A child Attribute
Copy link
Member

@Oberon00 Oberon00 May 12, 2020

Choose a reason for hiding this comment

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

A single child attribute? That does not sound useful. So instead of Attribute(3), I could have Attribute(Attribute(Attribute(3)))? That's probably not what you meant to say.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I think I understand: The attribute does include the key! Then I would allow the child attribute only in the array because Attribute(key=foo, value=Attribute(key=bar, value=42)) sounds useless.

Copy link
Author

@shengxil shengxil May 14, 2020

Choose a reason for hiding this comment

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

Appreciate the feedback! Yeah that makes sense. Even if some use cases need a single child attribute, it can still be placed in the array. I'll updating the PR.

- An array of primitive type values or children Attributes. The array MUST be
Copy link
Member

Choose a reason for hiding this comment

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

The array restrictions (no nested arrays, no different types) were made to ease implementation and APIs in statically typed languages. This PR would mostly negate this, because by using an array of attributes you could have different values inside these attributes, including arrays.

Copy link
Author

Choose a reason for hiding this comment

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

I would argue that the current homogeneous convention is made because some languages can't accept array with different member types. If we consider the whole Attribute as a firm type, and consider its value type and value as its property, then within an array all sibling Attribute are still the same type.

Programming-wise IMHO, Attribute encapsulates the data so from the array's point of view, the value type is invisible.

homogeneous, i.e. it MUST NOT contain values of different types.

The Span interface MUST provide:

Expand Down