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

Move http to main spec #82

Merged
42 changes: 42 additions & 0 deletions semantic-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,48 @@ This way, the operator will not need to learn specifics of a language and
telemetry collected from multi-language micro-service can still be easily
correlated and cross-analyzed.

## HTTP client

This span type represents an outbound HTTP request.
danielkhan marked this conversation as resolved.
Show resolved Hide resolved

For a HTTP client span, `SpanKind` MUST be `Client`.

Given an [RFC 3986](https://www.ietf.org/rfc/rfc3986.txt) compliant URI of the form
`scheme:[//authority]path[?query][#fragment]`, the span name of the span SHOULD
Copy link
Member

Choose a reason for hiding this comment

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

-1

in OpenTracing we always explicitly recommended against doing that. In the REST services it is very common to have entity IDs as part of the path, e.g. /api/user/{uuid}. And since the instrumentation in general has no knowledge of whether the application's URL pattern includes entity IDs, recommending path as span name can easily lead to cardinality explosion.

Copy link
Member

Choose a reason for hiding this comment

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

---> #270

be set to to the URI path value.
danielkhan marked this conversation as resolved.
Show resolved Hide resolved

If a framework can identify a value that represents the identity of the request
and has a lower cardinality than the URI path, this value MUST be used for the span name instead.

| Attribute name | Notes and examples | Required? |
| :------------- | :----------------------------------------------------------- | --------- |
| `component` | Denotes the type of the span and needs to be `http`. | Yes |
danielkhan marked this conversation as resolved.
Show resolved Hide resolved
| `http.method` | HTTP request method. E.g. `"GET"`. | Yes |
| `http.url` | HTTP host. E.g. `"https://example.com:779/users/187a34"`. | Yes |
| `http.status_code` | [HTTP response status code](https://tools.ietf.org/html/rfc7231). E.g. `200` | No |
danielkhan marked this conversation as resolved.
Show resolved Hide resolved

## HTTP server

This span type represents an inbound HTTP request.

For a HTTP server span, `SpanKind` MUST be `Server`.

Given an inbound request for a route (e.g. `"/users/:userID?"` the `name`
attribute of the span SHOULD be set to this route.

If the route can not be determined, the `name` attribute MUST be set to the [RFC 3986 URI](https://www.ietf.org/rfc/rfc3986.txt) path value.

If a framework can identify a value that represents the identity of the request
and has a lower cardinality than the URI path or route, this value MUST be used for the span name instead.

| Attribute name | Notes and examples | Required? |
| :------------- | :----------------------------------------------------------- | --------- |
| `component` | Denotes the type of the span and needs to be `http`. | Yes |
| `http.method` | HTTP request method. E.g. `"GET"`. | Yes |
| `http.url` | HTTP host. E.g. `"https://example.com:779/users/187a34"`. | Yes |
| `http.route` | The matched route. E.g. `"/users/:userID?"`. | No |
| `http.status` | [HTTP response status code](https://tools.ietf.org/html/rfc7231). E.g. `200` | No |
danielkhan marked this conversation as resolved.
Show resolved Hide resolved

## Databases client calls

For database client call the `SpanKind` MUST be `Client`.
Expand Down
13 changes: 4 additions & 9 deletions work_in_progress/typedspans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ See [this document by @discostu105](https://docs.google.com/spreadsheets/d/1H0S0
Represents an outbound HTTP request.

##### Attributes
These attributes are not covered in the [main spec](../semantic-conventions.md):

- Method
SergeyKanzhelev marked this conversation as resolved.
Show resolved Hide resolved
- Host
- Path
- Status Code
- Route
- User Agent
- Parameters
Expand All @@ -57,11 +54,9 @@ Represents an outbound HTTP request.
Represents an inbound HTTP request.

##### Attributes
- Method
- Host
- Path
- Status Code
- Route

These attributes are not covered in the [main spec](../semantic-conventions.md):

- User Agent
- Webserver Name
- Remote Address
Expand Down