{{- define "metric-documenation" -}}
{{- $metricName := . }}
{{- $metric := $metricName | metricInfo -}}

### {{ $metricName }}

{{ $metric.Description }}

{{- if $metric.ExtendedDocumentation }}

{{ $metric.ExtendedDocumentation }}

{{- end }}

| Unit | Metric Type | Value Type |{{ if $metric.Data.HasAggregated }} Aggregation Temporality |{{ end }}{{ if $metric.Data.HasMonotonic }} Monotonic |{{ end }}
| ---- | ----------- | ---------- |{{ if $metric.Data.HasAggregated }} ----------------------- |{{ end }}{{ if $metric.Data.HasMonotonic }} --------- |{{ end }}
| {{ $metric.Unit }} | {{ $metric.Data.Type }} | {{ $metric.Data.MetricValueType }} |
{{- if $metric.Data.HasAggregated }} {{ $metric.Data.AggregationTemporality }} |{{ end }}
{{- if $metric.Data.HasMonotonic }} {{ $metric.Data.Monotonic }} |{{ end }}

{{- if $metric.Attributes }}

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
{{- range $metric.Attributes }}
{{- $attribute := . | attributeInfo }}
| {{ $attribute.Name }} | {{ $attribute.Description }} |
{{- if $attribute.Enum }} {{ $attribute.Type }}: ``{{ stringsJoin $attribute.Enum "``, ``" }}``{{ else }} Any {{ $attribute.Type }}{{ end }} |
{{- end }}

{{- end }}

{{- end -}}

[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)

# {{ .Type }}

{{- if .Parent }}

**Parent Component:** {{ .Parent }}
{{- end }}

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:

```yaml
metrics:
  <metric_name>:
    enabled: false
```

{{- range $metricName, $metric := .Metrics }}
{{- if $metric.Enabled }}

{{ template "metric-documenation" $metricName }}

{{- end }}
{{- end }}

{{- $optionalMetricSeen := false }}
{{- range $metricName, $metric := .Metrics }}
{{- if not $metric.Enabled }}
{{- if not $optionalMetricSeen }}

## Optional Metrics

The following metrics are not emitted by default. Each of them can be enabled by applying the following configuration:

```yaml
metrics:
  <metric_name>:
    enabled: true
```

{{- end }}
{{- $optionalMetricSeen = true }}

{{ template "metric-documenation" $metricName }}

{{- end }}
{{- end }}

{{- if .ResourceAttributes }}

## Resource Attributes

| Name | Description | Values | Enabled |
| ---- | ----------- | ------ | ------- |
{{- range $attributeName, $attribute := .ResourceAttributes }}
| {{ $attributeName }} | {{ $attribute.Description }} |
{{- if $attribute.Enum }} {{ $attribute.Type }}: ``{{ stringsJoin $attribute.Enum "``, ``" }}``{{ else }} Any {{ $attribute.Type }}{{ end }} | {{ $attribute.Enabled }} |
{{- end }}

{{- end }}
