-
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.
Merge branch 'main' into dependabot/dependabot-prs/2024-04-04T204146
- Loading branch information
Showing
4 changed files
with
1,123 additions
and
1 deletion.
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
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,49 @@ | ||
{%- macro to_go_name(fqn) -%} | ||
{{fqn | replace(".", " ") | replace("_", " ") | title | replace(" ", "")}} | ||
{%- endmacro -%} | ||
{%- 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 metric.stability|string() == "StabilityLevel.DEPRECATED" or not metric.brief-%} | ||
{{ to_go_name(metric.metric_name) }} is the metric conforming to the "{{ metric.metric_name}}" semantic conventions. | ||
{%- else -%} | ||
{{ to_go_name(metric.metric_name) }} is the metric conforming to the "{{ metric.metric_name}}" semantic conventions. {{ it_reps(metric.brief)|trim(".") }}. | ||
{%- endif %} | ||
{%- endmacro -%} | ||
{%- macro format_stability(stability) -%} | ||
{%- if not stability -%} | ||
Experimental | ||
{%- else -%} | ||
{{ stability|replace("StabilityLevel.", "")|capitalize() }} | ||
{%- endif %} | ||
{%- endmacro -%} | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Code generated from semantic convention specification. DO NOT EDIT. | ||
|
||
package semconv // import [[IMPORTPATH]] | ||
|
||
const ( | ||
{% for id in semconvs %} | ||
{%- if semconvs[id].GROUP_TYPE_NAME == 'metric' %}{% set metric = semconvs[id] %} | ||
// {{ keydoc(metric) | wordwrap(76, break_long_words=false, break_on_hyphens=false, wrapstring="\n// ") }} | ||
// Instrument: {{ metric.instrument }} | ||
// Unit: {{ metric.unit }} | ||
// Stability: {{ format_stability(metric.stability) }} | ||
{%- if not metric.brief %} | ||
// NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. | ||
{%- endif %} | ||
{{to_go_name(metric.metric_name)}}Name = "{{metric.metric_name}}" | ||
{{to_go_name(metric.metric_name)}}Unit = "{{metric.unit}}" | ||
{%- if metric.brief %} | ||
{{to_go_name(metric.metric_name)}}Description = "{{metric.brief}}" | ||
{%- endif %} | ||
{%- endif %} | ||
{% endfor %} | ||
) |
Oops, something went wrong.