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 int and double types. Small bugfixes. #30

Merged
merged 3 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def attributes(self):

def unique_attributes(attributes):
output = []
for x in l:
for x in attributes:
if x.fqn not in [attr.fqn for attr in output]:
output.append(x)
return output
Expand Down Expand Up @@ -237,7 +237,14 @@ def parse_id(attribute):
and examples is not None
):
examples = [examples]
if is_simple_type and attr_type not in ["boolean", "boolean[]"]:
if is_simple_type and attr_type not in [
"boolean",
"boolean[]",
"int",
"int[]",
"double",
"double[]",
]:
thisthat marked this conversation as resolved.
Show resolved Hide resolved
if examples is None or (len(examples) == 0):
position = attribute.lc.data[list(attribute)[0]]
msg = "Empty examples for {} are not allowed".format(attr_type)
Expand Down Expand Up @@ -275,17 +282,21 @@ def is_simple_type(attr_type: str):
return attr_type in (
"string",
"string[]",
"number",
"number[]",
"int",
Copy link
Member

Choose a reason for hiding this comment

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

will it break all active PRs? Maybe keep number, than fix yamls and then remove number?

Copy link
Member Author

Choose a reason for hiding this comment

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

This won't break active PRs until we bump the tool version in the Github action

"int[]",
"double",
"double[]",
"boolean",
"boolean[]",
Comment on lines 283 to 290
Copy link
Member

Choose a reason for hiding this comment

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

If you make the dictionary in type_mapper a (static) constant, you can just do if attr_type in that_dict (in checks the keys with a dictionary right-hand side)

)

@staticmethod
def type_mapper(attr_type: str):
thisthat marked this conversation as resolved.
Show resolved Hide resolved
type_mapper = {
"number": int,
"number[]": int,
"int": int,
"int[]": int,
"double": float,
"double[]": float,
"string": str,
"string[]": str,
"boolean": bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def to_markdown_attr(
description += " [{}]".format(len(self.render_ctx.notes))
examples = ""
if isinstance(attribute.attr_type, EnumAttributeType):
if attribute.is_local and not attribute.ref:
if self.render_ctx.is_full or (attribute.is_local and not attribute.ref):
self.render_ctx.add_enum(attribute)
example_list = attribute.examples if attribute.examples else ()
examples = (
Expand Down Expand Up @@ -399,6 +399,12 @@ def _render_table(self, semconv, parameters, output):
continue
if self.render_ctx.is_full or attr.is_local:
attr_to_print.append(attr)
if self.render_ctx.group_key is not None and not attr_to_print:
thisthat marked this conversation as resolved.
Show resolved Hide resolved
raise ValueError(
"No attributes retained for '{}' filtering by '{}'".format(
semconv.semconv_id, self.render_ctx.group_key
)
)
if attr_to_print:
output.write(MarkdownRenderer.table_headers)
for attr in attr_to_print:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.2.0"
__version__ = "0.3.0"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | No |
| `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | No |
| `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | No |
| `http.status_code` | number | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_text` | string | **Deprecated: Use attribute `status_description` instead.**<br>[HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2). | `OK` | No |
| `http.flavor` | string | **Deprecated. Use attribute `flavor_new` instead.**<br>Kind of HTTP protocol used [1] | `1.0` | No |
| `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | No |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
brief: 'The URI scheme identifying the used protocol.'
examples: ["http", "https"]
- id: status_code
type: number
type: int
required:
conditional: "If and only if one was received/sent"
brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
brief: 'The URI scheme identifying the used protocol.'
examples: ["http", "https"]
- id: status_code
type: number
type: int
required:
conditional: "If and only if one was received/sent"
brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
brief: 'The URI scheme identifying the used protocol.'
examples: ["http", "https"]
- id: status_code
type: number
type: int
required:
conditional: If and only if one was received/sent.
brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ groups:
Call-level attributes for Redis
attributes:
- id: database_index
type: number
type: int
required:
conditional: Required, if other than the default database (`0`).
brief: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Some database systems may allow a connection to switch to a different `db.user`,
| `db.user` | string | Username for accessing the database. | `readonly_user`; `reporting_user` | No |
| `net.peer.ip` | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | See below. |
| `net.peer.name` | string | Remote hostname or similar, see note below. | `example.com` | See below. |
| `net.peer.port` | number | Remote port number. | `80`; `8080`; `443` | Conditional [2] |
| `net.peer.port` | int | Remote port number. | `80`; `8080`; `443` | Conditional [2] |
| `net.transport` | string | Transport protocol used. See note below. | `IP.TCP` | Conditional [3] |

**[1]:** It is recommended to remove embedded credentials.
Expand Down Expand Up @@ -187,7 +187,7 @@ For example, when retrieving a document, `db.operation` would be set to (literal
<!-- semconv db.redis -->
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `db.redis.database_index` | number | The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. | `0`; `1`; `15` | Conditional [1] |
| `db.redis.database_index` | int | The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. | `0`; `1`; `15` | Conditional [1] |

**[1]:** Required, if other than the default database (`0`).
<!-- endsemconv -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Some database systems may allow a connection to switch to a different `db.user`,
| `db.user` | string | Username for accessing the database. | `readonly_user`<br>`reporting_user` | No |
| `net.peer.ip` | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | Conditional<br>See below. |
| `net.peer.name` | string | Remote hostname or similar, see note below. | `example.com` | Conditional<br>See below. |
| `net.peer.port` | number | Remote port number. | `80`<br>`8080`<br>`443` | Conditional [2] |
| `net.peer.port` | int | Remote port number. | `80`<br>`8080`<br>`443` | Conditional [2] |
| `net.transport` | string enum | Transport protocol used. See note below. | `IP.TCP` | Conditional [3] |

**[1]:** It is recommended to remove embedded credentials.
Expand Down Expand Up @@ -187,7 +187,7 @@ For example, when retrieving a document, `db.operation` would be set to (literal
<!-- semconv db.redis -->
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `db.redis.database_index` | number | The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. | `0`<br>`1`<br>`15` | Conditional [1] |
| `db.redis.database_index` | int | The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. | `0`<br>`1`<br>`15` | Conditional [1] |

**[1]:** Required, if other than the default database (`0`).
<!-- endsemconv -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | See below |
| `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | See below |
| `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | See below |
| `http.status_code` | number | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_text` | string | [HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2). | `OK` | No |
| `http.flavor` | string | Kind of HTTP protocol used [1] | `1.0` | No |
| `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | No |
Expand All @@ -28,4 +28,24 @@
* `http.scheme`, `http.host`, `http.target`
* `http.scheme`, [`http.server_name`](input_http.md), `net.host.port`, `http.target`
* `http.scheme`, `net.host.name`, `net.host.port`, `http.target`

`faas.trigger` MUST be one of the following:

| Value | Description |
|---|---|
| `datasource` | A response to some data source operation such as a database or filesystem read/write. |
| `http` | To provide an answer to an inbound HTTP request |
| `pubsub` | A function is set to be executed when messages are sent to a messaging system. |
| `timer` | A function is scheduled to be executed regularly. |
| `other` | other |

`http.flavor` MUST be one of the following or, if none of the listed values apply, a custom value:

| Value | Description |
|---|---|
| `1.0` | HTTP 1.0 |
| `1.1` | HTTP 1.1 |
| `2.0` | HTTP 2 |
| `SPDY` | SPDY protocol. |
| `QUIC` | QUIC protocol. |
<!-- endsemconv -->
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
brief: 'The URI scheme identifying the used protocol.'
examples: ["http", "https"]
- id: status_code
type: number
type: int
required:
conditional: "If and only if one was received/sent"
brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
brief: 'The URI scheme identifying the used protocol.'
examples: ["http", "https"]
- id: status_code
type: number
type: int
required:
conditional: "If and only if one was received/sent"
brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | No |
| `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | No |
| `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | No |
| `http.status_code` | number | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_text` | string | [HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2). | `OK` | No |
| `http.flavor` | string | Kind of HTTP protocol used [1] | `1.0` | No |
| `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | No |
Expand All @@ -35,7 +35,7 @@
| `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | No |
| `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | No |
| `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | No |
| `http.status_code` | number | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | If and only if one was received/sent |
| `http.status_text` | string | [HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2). | `OK` | No |
| `http.flavor` | string | Kind of HTTP protocol used [1] | `1.0` | No |
| `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | No |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
brief: 'The URI scheme identifying the used protocol.'
examples: ["http", "https"]
- id: status_code
type: number
type: int
required:
conditional: "If and only if one was received/sent"
brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ groups:
[RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6)
examples: '127.0.0.1'
- id: peer.port
type: number
type: int
brief: 'Remote port number.'
examples: [80, 8080, 443]
- id: peer.name
Expand All @@ -54,7 +54,7 @@ groups:
brief: 'Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host.'
examples: '192.168.0.1'
- id: host.port
type: number
type: int
brief: 'Like `net.peer.port` but for the host port.'
examples: 35555
- id: host.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
brief: 'The URI scheme identifying the used protocol.'
examples: ["http", "https"]
- id: status_code
type: number
type: int
required:
conditional: If and only if one was received/sent.
brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).'
Expand Down
Loading