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

Don't render deprecated enum members in semconv tables #1110

Merged
merged 3 commits into from
Jun 3, 2024
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
7 changes: 7 additions & 0 deletions .chloggen/1110.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
change_type: enhancement

component: other

note: "Don't render deprecated enum members in semconv tables."

issues: [1110]
2 changes: 0 additions & 2 deletions docs/system/system-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ available on the system, that is `system.memory.limit`.
| `buffers` | buffers | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `cached` | cached | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `free` | free | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `shared` | shared | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Removed, report shared memory usage with `metric.system.memory.shared` metric |
| `used` | used | ![Experimental](https://img.shields.io/badge/-experimental-blue) |


Expand Down Expand Up @@ -459,7 +458,6 @@ This metric is [recommended][MetricRecommended].
| `buffers` | buffers | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `cached` | cached | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `free` | free | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `shared` | shared | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Removed, report shared memory usage with `metric.system.memory.shared` metric |
| `used` | used | ![Experimental](https://img.shields.io/badge/-experimental-blue) |


Expand Down
5 changes: 3 additions & 2 deletions templates/registry/markdown/enum_macros.j2
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% import 'stability.j2' as stability %}
{% macro filter(member) %}{% if snippet_type is not defined or (member.deprecated is none or member.deprecated == "") %}{{ "True" }}{% else %}{{ "False" }}{% endif %}{% endmacro %}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I might be late to the review, but filter usually filters things out, so I was stumbled upon usage, where we filter member but still continue to process it later
So semantically it should be False for good member and True for deprecated one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% macro filter(member) %}{% if snippet_type is not defined or (member.deprecated is none or member.deprecated == "") %}{{ "True" }}{% else %}{{ "False" }}{% endif %}{% endmacro %}
{% macro filter_deprecated(member) %}{% if snippet_type is not defined or (member.deprecated is none or member.deprecated == "") %}{{ "False" }}{% else %}{{ "True" }}{% endif %}{% endmacro %}

something like this

{% macro table(enum, notes) %}
`{{enum.name}}` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
{% for espec in enum.type.members | sort(attribute='value') %}| `{{ espec.value }}` | {{ (espec.brief or espec.id) | trim }}{{ notes.add(espec.note) }} | {{ stability.badge(espec.stability, espec.deprecated) }} |
{% endfor %}{{ notes.render() }}{% endmacro %}
{% for espec in enum.type.members | sort(attribute='value') %}{% if filter(espec) == "True" %}| `{{ espec.value }}` | {{ (espec.brief or espec.id) | trim }}{{ notes.add(espec.note) }} | {{ stability.badge(espec.stability, espec.deprecated) }} |
{% endif %}{% endfor %}{{ notes.render() }}{% endmacro %}
{% macro tables(enums, notes) %}{% for enum in enums | sort(attribute="name") %}{{ table(enum, notes) }}
{% endfor %}{% endmacro %}
Loading