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

Extend semantic conventions for RPC and allow non-gRPC calls #604

Merged
merged 15 commits into from
Jun 17, 2020

Conversation

arminru
Copy link
Member

@arminru arminru commented May 14, 2020

I generalized the semantic conventions to allow RPC systems other than gRPC.
Therefore, I added an attribute rpc.system (like we have for messaging systems as messaging.system here) to identify the RPC system being used and added a section for gRPC, defining rpc.system="grpc" in this case.
Once we use proper YAML definitions, we can add a list of well-known descriptors to be used in addition to the ones I mentioned as examples.

Additionally, I added the method name as an attribute so that it doesn't have to be parsed out of the span name. This also makes it available for sampling decisions since the span name is not reliable to use here (#468).

By requiring the net.transport attribute to be set for non-IP connections we ensure that connections via named pipe bindings, for example, can be properly detected.

I didn't touch the rpc.service attribute already present but was wondering if we should change it to be the fully-qualified service name including $package, rather than just the unqualified name. What do you think?

I'm also considering to add an attribute for the logical endpoint which might be different from the physical endpoint described using the net.peer.* attributes. This would be particularly significant in scenarios where a service registry is used to resolve endpoints. We can either add it here or discuss it separately on a follow-up PR.

Resolves #27.

@arminru
Copy link
Member Author

arminru commented May 26, 2020

@open-telemetry/specs-approvers Anyone willing to have a look? 🙂

specification/trace/semantic_conventions/rpc.md Outdated Show resolved Hide resolved
specification/trace/semantic_conventions/rpc.md Outdated Show resolved Hide resolved
* [Status](#status)
* [Events](#events)

<!-- tocstop -->

## gRPC
## Common remote procedure call conventions
Copy link
Member

Choose a reason for hiding this comment

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

Common RPC conventions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you suggest to shorten the heading or are you questioning the wording?

Comment on lines 54 to 55
| `rpc.service` | The full name of the service being called, including its package name, if applicable. | Yes |
| `rpc.method` | The name of the method being called, must be equal to the $method part in the span name. | Yes |
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need these conventions? Looks like duplicate information with the name. I would definitely not make them required.

Copy link
Member Author

Choose a reason for hiding this comment

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

rpc.system is not part of the span name
rpc.service was already there, I think it was taken over from OpenTracing where it was called peer.service
rpc.method is new

While the latter two are part of the suggested span name, I'd rather have them available without having to parse the name and decompose the components.
On all other semantic conventions the most valuable data, which is used to detect and distinguish services, is provided using attributes and not from parsing the span name, even though this results in some duplication.
I deem the span name less reliable since it's intended as a grouping key and/or to provide a human-readable friendly name rather than a definite, structured data format. I'd expect deviations from the span name guidelines defined in the spec more frequently than not adhering to the attributes defined therein. For example, one could add a "RPC call to xy" prefix to the span name above to "make it look nicer in the UI" even though this would not be allowed as per the spec.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I can buy the "send duplicate data" to avoid "parsing". How do we know which one is more expensive? I would simply not make them required.

Copy link
Member Author

Choose a reason for hiding this comment

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

Avoiding parsing is one of three reasons I stated in my comment above.
The main reason is that it's in my opinion the least reliable data point we have on a span. All other semantic conventions say something along "you should use this span name or alternatively that but you can also use something else if it suits better or is of lower cardinality", so I personally doubt that users/instrumenters will adhere 100% to the guidelines laid out regarding span names. As long as it still makes a good, low-cardinality grouping key, this would be mostly fine, however.
For detecting services from span, I certainly prefer well-defined unambiguous attributes over something that is the main identifier showing up in the UI. The human-readable span name in the UI might, IMHO, be more likely to be populated with something else, because it's more favorable, self-explaining, human-readable or otherwise preferred by users looking at the UI (even if the spec would be pretty strict about it in this particular semantic convention).

Copy link
Member

Choose a reason for hiding this comment

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

My fight is still that this should not be required. I am fine and would approve this change if that is removed.

Copy link
Member

Choose a reason for hiding this comment

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

I feel that required means will not be able to consume data without this field, which is not the case for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, I'll make it recommended instead of required and we can revisit it if #653 brings any applicable changes to the definition of required.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bogdandrutu I made rpc.method not required. Should I also remove the requirement for rpc.service that is already in place in the current spec version or leave it as it is?

Copy link
Member

Choose a reason for hiding this comment

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

Yes please rpc.service should be the same.

OffTopic: Probably we should have 3 options (we can discuss in an issue OPTIONAL, RECOMMENDED, REQUIRED) then we should have very few `REQUIRED.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bogdandrutu done.

Your proposal sounds reasonable, we should discuss this on #653.

@anuraaga
Copy link
Contributor

Had one thought about rpc.service. I think in tracing systems, having a good service name is very important for features like dependency graphs, and this applies to all spans. Does it make sense to move service.name to the span general attributes instead of having it RPC-only? I don't think I've seen a tracing system that doesn't handle service name in a special way as a first class citizen.

The example I am thinking of is Redis. There is no descriptive name for a redis database, it's up to how the user code uses it, so a redis may be named UserCache in block diagrams and as variable names but does not appear in the URL if it uses IP address or anywhere else. I don't think the DB semantic conventions can cover this, but it doesn't seem like it should be a RPC either. If Redis itself was traced, it's Resource would have the correct name, but for databases where we won't accept them to have spans (at least not for years I'd say), it's important that the client can set the service name and this seems like a generic concept across many types.

@Oberon00
Copy link
Member

Oberon00 commented Jun 10, 2020

@anuraaga: @yurishkuro noted in #604 (comment) that they used a peer.service attribute in a way similar to what you propose. I think you should create an issue for that. It sounds useful, but not really related to rpc.

@anuraaga
Copy link
Contributor

@Oberon00 thanks for the recommendation, filed #648 :)

@arminru arminru added the spec:trace Related to the specification/trace directory label Jun 15, 2020
@bogdandrutu bogdandrutu merged commit 99b31d4 into open-telemetry:master Jun 17, 2020
@arminru arminru deleted the semconv-rpc branch June 17, 2020 19:40
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
…lemetry#604)

* Generalize RPC semantic conventions to allow non-gRPC spans

* Add method name to attributes

* Require specifying `net.transport` for non-IP connections

* Do not require providing the port when it's not available

* Add package name to rpc.service and make it optional when not applicable or unknown

* Add note and example distinguishing the service.name resource attribute from rpc.service

* Distinguish RPC spans from HTTP spans

* Improve wording

Co-authored-by: Christian Neumüller <[email protected]>

* Improve wording

* Improve wording even more

Co-authored-by: Christian Neumüller <[email protected]>

* Clarify span name format

* Update changelog

* rpc.method: required -> recommended

* rpc.service: required -> recommended

Co-authored-by: Christian Neumüller <[email protected]>
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.

Extend semantic conventions for RPC
7 participants