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

Render notes on metric semconv tables #177

Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -224,8 +224,14 @@ def to_markdown_metric_table(
"| Name | Instrument Type | Unit (UCUM) | Description |\n"
"| -------- | --------------- | ----------- | -------------- |\n"
)

description = semconv.brief
if semconv.note:
self.render_ctx.add_note(semconv.note)
description += f" [{len(self.render_ctx.notes)}]"

output.write(
f"| `{semconv.metric_name}` | {instrument} | `{semconv.unit}` | {semconv.brief} |\n"
f"| `{semconv.metric_name}` | {instrument} | `{semconv.unit}` | {description} |\n"
)
self.to_markdown_notes(output)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<!-- semconv metric.foo.size(metric_table) -->
| Name | Instrument Type | Unit (UCUM) | Description |
| -------- | --------------- | ----------- | -------------- |
| `foo.size` | Histogram | `{bars}` | Measures the size of foo. |
| `foo.size` | Histogram | `{bars}` | Measures the size of foo. [1] |

**[1]:** Some notes on metric.foo.size
<!-- endsemconv -->

**Attributes for `foo.size`**
Expand All @@ -26,6 +28,8 @@
<!-- semconv metric.foo.active_eggs -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `bar.egg.type` | string | Type of egg. | `chicken`; `emu`; `dragon` | Conditionally Required: if available to instrumentation. |
| `bar.egg.type` | string | Type of egg. [1] | `chicken`; `emu`; `dragon` | Conditionally Required: if available to instrumentation. |
| `http.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | Opt-In |

**[1]:** Some notes on attribute
<!-- endsemconv -->
4 changes: 4 additions & 0 deletions semantic-conventions/src/tests/data/yaml/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ groups:
type: string
brief: 'Type of egg.'
examples: ["chicken", "emu", "dragon"]
note: >
Some notes on attribute

- id: metric.foo.size
prefix: foo
Expand All @@ -18,6 +20,8 @@ groups:
brief: "Measures the size of foo."
instrument: histogram
unit: "{bars}"
note: >
joaopgrassi marked this conversation as resolved.
Show resolved Hide resolved
Some notes on metric.foo.size
attributes:
- ref: http.method
requirement_level: required
Expand Down