-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new workflow to generate v1.27.0.
- Loading branch information
Showing
9 changed files
with
12,941 additions
and
9,823 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{% import 'helpers.j2' as h %} | ||
{# TODO - REQUIREMNET LEVEL SHOULD NOT BE USED IN ATTRIBUTE REGISTRY #} | ||
{%- macro requirement_level_doc(attr) -%} | ||
{%- if attr.requirement_level == "required" -%} | ||
Requirement Level: Required | ||
{% elif attr.requirement_level.conditionally_required %} | ||
Requirement Level: Conditionally Required - {{ attr.requirement_level.conditionally_required }} | ||
{%- elif attr.requirement_level == "recommended" -%} | ||
Requirement Level: Recommended | ||
{% elif attr.requirement_level.recommended %} | ||
Requirement Level: Recommended - {{ attr.requirement_level.recommended }} | ||
{%- else -%} | ||
Requirement Level: Optional | ||
{%- endif %} | ||
{%- endmacro -%} | ||
{%- macro deprecated_doc(attr) -%} | ||
{% if attr is deprecated %}Deprecated: {{ attr.deprecated }}{% endif %} | ||
{%- endmacro -%} | ||
{%- macro notes_doc(attr) -%} | ||
{% if attr.note %}Note: {{ attr.note }}{% endif %} | ||
{%- endmacro -%} | ||
{%- macro examples_doc(attr) -%} | ||
{%- if attr.examples is iterable %} | ||
Examples: {{ attr.examples | pprint | trim("[]") }} | ||
{%- endif -%} | ||
{%- endmacro -%} | ||
{%- macro keydoc(attr) -%} | ||
{{ attr.brief }} | ||
Stability: {{ attr.stability | title }} | ||
{% if attr is enum %}Type: Enum{% else %}Type: {{ attr.type }}{% endif %} | ||
{{ deprecated_doc(attr) }} | ||
{{ examples_doc(attr) }} | ||
{{ notes_doc(attr) }} | ||
{%- endmacro -%} | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Code generated from semantic convention specification. DO NOT EDIT. | ||
|
||
package semconv // import "go.opentelemetry.io/otel/semconv/{{params.tag}}" | ||
|
||
import "go.opentelemetry.io/otel/attribute" | ||
|
||
{% for group in ctx %} | ||
{% if group.attributes | length > 0 %} | ||
{# TODO - we're grouping by registry namespace, not attribute group, so we lose group docs #} | ||
{{ ["Namespace: " ~ group.root_namespace] | comment(format="go") }} | ||
const ( | ||
{% for attribute in group.attributes %} | ||
{%- if not attribute.type is template_type %}{# TODO - Go does not handle template attributes yet!!! #} | ||
{{ keydoc(attribute) | comment(format="go_1tab") }} | ||
{{h.to_go_name(attribute.name)}}Key = attribute.Key("{{attribute.name}}") | ||
{%- endif %} | ||
{%- endfor %} | ||
) | ||
{# Render a construction function #} | ||
{% for attribute in group.attributes %} | ||
{# TODO - Go does not handle template attributes yet!!! #} | ||
{%- if not attribute.type is template_type %} | ||
{{ [h.to_go_name(attribute.name) ~ " returns an attribute KeyValue conforming to the \"" ~ attribute.name ~"\"semantic conventions."] | comment(format="go") }} | ||
{{ ["It represents the " ~ attribute.brief] | comment(format="go") }} | ||
func {{h.to_go_name(attribute.name)}}(val {{attribute.type | instantiated_type | map_text("attribute_type_value")}}) attribute.KeyValue { | ||
return {{h.to_go_name(attribute.name)}}Key.{{attribute.type | instantiated_type | map_text("attribute_type_method")}}(val) | ||
} | ||
{%- endif %} | ||
{% endfor %} | ||
{# Render values for enums #} | ||
{%- for attribute in group.attributes %} | ||
{%- if attribute is enum %} | ||
{{ ["Enum values for " ~ attribute.name] | comment(format="go") }} | ||
var ( | ||
{% for value in attribute.type.members %} | ||
{{ [value.brief or value.id, "Stability: " ~ value.stability] | comment(format="go_1tab") }} | ||
{%- if value.deprecated %}{{ value.deprecated | comment(format="go_1tab") }}{% endif %} | ||
{{h.to_go_name(attribute.name ~ "." ~ value.id)}} = {{ h.to_go_name(attribute.name) }}Key.{{attribute.type | instantiated_type | map_text("attribute_type_method")}}({{ value.value | print_member_value }}) | ||
{%- endfor %} | ||
) | ||
{%- endif %} | ||
{% endfor %} | ||
{%- endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{%- macro to_go_name(fqn) -%} | ||
{{ fqn | title_case | replace(" ", "") | acronym }} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% import 'helpers.j2' as h %} | ||
{%- macro it_reps(brief) -%} | ||
It represents {% if brief[:2] == "A " or brief[:3] == "An " or brief[:4] == "The " -%} | ||
{{ brief[0]|lower }}{{ brief[1:] }} | ||
{%- else -%} | ||
the {{ brief[0]|lower }}{{ brief[1:] }} | ||
{%- endif -%} | ||
{%- endmacro -%} | ||
{%- macro keydoc(metric) -%} | ||
{%- if not metric.brief -%} | ||
{{ h.to_go_name(metric.metric_name) }} is the metric conforming to the "{{ metric.metric_name}}" semantic conventions. | ||
{%- else -%} | ||
{{ h.to_go_name(metric.metric_name) }} is the metric conforming to the "{{ metric.metric_name}}" semantic conventions. {{ it_reps(metric.brief)|trim(".") }}. | ||
{%- endif %} | ||
{%- endmacro -%} | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Code generated from semantic convention specification. DO NOT EDIT. | ||
|
||
package semconv // import "go.opentelemetry.io/otel/semconv/{{params.tag}}" | ||
|
||
const ( | ||
{% for metric in ctx %} | ||
{{ keydoc(metric) | comment(indent=2) }} | ||
// Instrument: {{ metric.instrument }} | ||
// Unit: {{ metric.unit }} | ||
// Stability: {{ metric.stability }} | ||
{%- if metric is deprecated %} | ||
// Deprecated: {{ metric.deprecated }} | ||
{%- endif %} | ||
{%- if not metric.brief %} | ||
// NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. | ||
{%- endif %} | ||
{{ h.to_go_name(metric.metric_name) }}Name = "{{ metric.metric_name }}" | ||
{{ h.to_go_name(metric.metric_name) }}Unit = "{{ metric.unit }}" | ||
{%- if metric.brief %} | ||
{{ h.to_go_name(metric.metric_name) }}Description = "{{ metric.brief | trim }}" | ||
{%- endif %} | ||
{% endfor %} | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.