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 yaml semantic conventions for Database #928

Merged
merged 2 commits into from
Sep 11, 2020

Conversation

thisthat
Copy link
Member

@thisthat thisthat commented Sep 7, 2020

Changes

Updated Database semantic convention to the YAML format.

Related issues #547

@thisthat thisthat requested review from a team September 7, 2020 12:28
@arminru arminru linked an issue Sep 8, 2020 that may be closed by this pull request
Comment on lines +47 to +50
**Additional attribute requirements:** At least one of the following sets of attributes is required:

* [`net.peer.name`](span-general.md)
* [`net.peer.ip`](span-general.md)
Copy link
Member

Choose a reason for hiding this comment

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

Strictly speaking, this single attribute is not a set, at least not in that notation. Should we add surrounding parentheses in the MD generator or is it clear enough that it is either the first or the second line (not both together as one set)?

Copy link
Member

Choose a reason for hiding this comment

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

+1 to @arminru. I am confused by the reference to "sets".

Copy link
Member Author

Choose a reason for hiding this comment

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

Would the phrase "At least one of the following is required:" be a good replacement?

Copy link
Member

Choose a reason for hiding this comment

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

If we then add "All of:" to each set with more than one attribute (we have none here, but for example in the HTTP conventions), that would be a good improvement I think.

semantic_conventions/trace/database.yaml Outdated Show resolved Hide resolved
semantic_conventions/trace/database.yaml Outdated Show resolved Hide resolved
type: string
brief: >
Username for accessing the database.
examples: ['readonly_user', 'reporting_user']
Copy link
Member

Choose a reason for hiding this comment

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

It is not completely obvious in the resulting markdown that these are 2 distinct examples. It was clear in the original markdown. Perhaps remove one of the examples to avoid confusion.

tag: connection-level
required:
conditional: See below.
- ref: net.peer.ip
Copy link
Member

Choose a reason for hiding this comment

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

Being able to reference other attributes is very nice!

Comment on lines +47 to +50
**Additional attribute requirements:** At least one of the following sets of attributes is required:

* [`net.peer.name`](span-general.md)
* [`net.peer.ip`](span-general.md)
Copy link
Member

Choose a reason for hiding this comment

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

+1 to @arminru. I am confused by the reference to "sets".

<!-- semconv db.mssql(tag=connection-level-tech-specific,remove_constraints) -->
| Attribute | Type | Description | Example | Required |
|---|---|---|---|---|
| `db.jdbc.driver_classname` | string | The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. | `org.postgresql.Driver`<br>`com.microsoft.sqlserver.jdbc.SQLServerDriver` | No |
Copy link
Member

Choose a reason for hiding this comment

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

The example is confusing, not clear that it is 2 examples since I can just imagine it one line that is wrapped in a table cell.
Either use one example or enumerate them somehow to make it clear.

Copy link
Member

Choose a reason for hiding this comment

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

this is not new to this document. My suggestion would be to address it in different PR.

Copy link
Member

Choose a reason for hiding this comment

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

In the rendered view it is displayed more nicely:
image
We could update the markdown generator to add a comma in between, to make it even clearer. That would be a separate issue in https://github.com/open-telemetry/build-tools/, however.

Copy link
Member

Choose a reason for hiding this comment

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

The example is confusing

I think with the new generator, you should either read the YAML source or the rendered markdown. The raw, unrendered markdown tables were barely readable already previously, and with the addition of the type column, its just unreadable IMHO. But that's OK, that's why we use a generator.

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 make it clear I meant: it is rendered differently by the generator. In the original we had this:

image

in the new generated version we have this:

image

I think the usage of "or" in the original version makes it clear that these 2 examples. In the new version it is not so apparent even though they are on 2 separate lines.

We can probably try to improve the generator to add an "or" between examples. Doesn't have to be done in this PR, can be improved in the future. Looks good otherwise to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've created open-telemetry/build-tools#8 to track these changes :)

tag: call-level
type: string
required:
conditional: Required, if `db.statement` is not applicable.
Copy link
Member

Choose a reason for hiding this comment

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

would be cool to be able to use attribute reference in descriptions as well =)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, also for generated Javadoc, etc. But that's a rather complex feature as we would need to parse the markdown in the tool then.

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.

beyond small comments from @arminru and @tigrannajaryan it looks good.

@Oberon00 Oberon00 added area:semantic-conventions Related to semantic conventions spec:trace Related to the specification/trace directory labels Sep 9, 2020
<!-- semconv db.mssql(tag=connection-level-tech-specific,remove_constraints) -->
| Attribute | Type | Description | Example | Required |
|---|---|---|---|---|
| `db.jdbc.driver_classname` | string | The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. | `org.postgresql.Driver`<br>`com.microsoft.sqlserver.jdbc.SQLServerDriver` | No |
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 make it clear I meant: it is rendered differently by the generator. In the original we had this:

image

in the new generated version we have this:

image

I think the usage of "or" in the original version makes it clear that these 2 examples. In the new version it is not so apparent even though they are on 2 separate lines.

We can probably try to improve the generator to add an "or" between examples. Doesn't have to be done in this PR, can be improved in the future. Looks good otherwise to me.

@SergeyKanzhelev
Copy link
Member

please rebase so I can merge this PR.

@SergeyKanzhelev SergeyKanzhelev merged commit acd6f77 into open-telemetry:master Sep 11, 2020
@thisthat thisthat deleted the yaml-db branch October 5, 2020 06:45
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
* Add yaml semantic conventions for Database

* Address feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:semantic-conventions Related to semantic conventions spec:trace Related to the specification/trace directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Define semantic conventions in JSON/YAML
5 participants