-
Notifications
You must be signed in to change notification settings - Fork 54
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 for embedding of single attributes #332
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
semantic-conventions/src/tests/data/markdown/ref_embed/expected.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Server | ||
|
||
<!-- semconv registry.geo(full) --> | ||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | | ||
|---|---|---|---|---|---| | ||
| `geo.country` | string | country of the geo coordinates. | `US` | `Recommended` | Experimental | | ||
| `geo.lat` | string | latitude of the geo coordinates. | `123.456` | `Recommended` | Experimental | | ||
| `geo.lon` | string | longitude of the geo coordinates. | `234.456` | `Recommended` | Experimental | | ||
<!-- endsemconv --> | ||
|
||
|
||
<!-- semconv registry.server(full) --> | ||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | | ||
|---|---|---|---|---|---| | ||
| `server.geo.lat` | string | My own latitude | `123.456` | `Recommended` | Experimental | | ||
| `server.id` | string | some server id | `123` | `Recommended` | Experimental | | ||
<!-- endsemconv --> |
24 changes: 24 additions & 0 deletions
24
semantic-conventions/src/tests/data/markdown/ref_embed/geo.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
groups: | ||
- id: registry.geo | ||
brief: Attributes describing geo. | ||
type: attribute_group | ||
prefix: geo | ||
attributes: | ||
- id: lat | ||
type: string | ||
stability: experimental | ||
brief: > | ||
latitude of the geo coordinates. | ||
examples: ["123.456"] | ||
- id: lon | ||
type: string | ||
stability: experimental | ||
brief: > | ||
longitude of the geo coordinates. | ||
examples: [ "234.456" ] | ||
- id: country | ||
type: string | ||
stability: experimental | ||
brief: > | ||
country of the geo coordinates. | ||
examples: [ "US" ] |
8 changes: 8 additions & 0 deletions
8
semantic-conventions/src/tests/data/markdown/ref_embed/input.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Server | ||
|
||
<!-- semconv registry.geo(full) --> | ||
<!-- endsemconv --> | ||
|
||
|
||
<!-- semconv registry.server(full) --> | ||
<!-- endsemconv --> |
15 changes: 15 additions & 0 deletions
15
semantic-conventions/src/tests/data/markdown/ref_embed/server.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
groups: | ||
- id: registry.server | ||
prefix: server | ||
type: attribute_group | ||
brief: "Describes information about the server." | ||
attributes: | ||
- id: id | ||
type: string | ||
stability: experimental | ||
brief: > | ||
some server id | ||
examples: ['123'] | ||
- ref: geo.lat | ||
prefix: true | ||
brief: My own latitude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I believe we previously discussed
embed: geo.lat
instead ofref: geo.lat
andprefix: true
.What would be the reason to not do
embed: geo.lat
based on the original design and do theprefix
flag instead?Why I'd prefer a new verb (
embed
)ref
always means the same thing - reference attribute and keep the original name.ref
andprefix
and how hard it'd be to understand what name is supposed to be generatedprefix
feels like a string property and not a boolean flag.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.
we have discussed it few weeks ago while I have started to implement it in weaver, so that
ref
andembed
are the same in functionality and difference is only in prefixing the parent namespace or not. Hence this approach was selected. Embed will stay for the whole namespace.I have announced this change also in embed issue linked in this PR
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.
it still has all the problems listed above, so I'd like to revisit this choice
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.
I can address these problems because IMO they are not critical
embed
meansref
+prefix
of the parent group. And this is how it was implementedref
+prefix
) instead just (embed
), but I don't feel it's something complicatedThe main reason why we went this way was as described before complete similarity between ref and new embed, therefore we have decided to go with it.
I would like to get more opinions on this @jsuereth @lquerel
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.
So do you agree that these are problems, critical or not, and ideally we would have one-line that expresses that attribute is embedded instead of two?
It'd also be confusing to have
ref
to embed one attribute andembed
to embed all.If we want to support both, let's find a good option with
embed_one
+embed_all
,embed
+embed_all
, etc.I'm struggling to come up with a real-life use-case for "embed-all-attributes from" and I see a lot of places where embed-one would work great. So both of the above options seem reasonable to me.
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.
we do have already an option to embed all and embed only one. They are written in the original issue. Embeded namespaces will be defined on the top level of the group, while embedded attribute is defined under attributes.
we do have a lot of such real examples. The most prominent one is about
geo
namespace included intoclient
orserver
. Thenprocess
included intoprocess
as parent node and so on.In both. On tolling side it has the same implementation with additional prefix. On semantical meaning they also both are references to another namespace with difference in prefix.
Let's discuss it tomorrow during our tooling meeting
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.
Let's get back to the original concern: having
prefix: true
under reference has problems (critical or not). We should try to design schema to be easy to use, easy to read, etc. The "not a critical problem" is not a good argument.Having
embed_one
andembed_all
verbs would result in much better outcome for schema users. So why the pushback?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.
As I have stated before, this decision was made due to similarity of ref and embed functionality. I don't see this as a problem otherwise I wouldn't go and implement it.
Therefore I propose to discuss it once more during our meeting
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.
I do see above problems with this approach, which would be resolved if we used
embed_one
or similar with no visible downsides.The embedding is semantically similar to definition of the attribute (as it creates new attribute).
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.
We have discussed it yesterday and I will propose new ideas after a meeting with @lquerel today
Thank you for raising your concerns here.