-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mdatagen] Improve generated documentation
- Split Metrics into two sections: Default Metrics and Optional Metrics - Split Attributes section and move attributes to the metrics where they applicable to make it clear which attributes applied to a particular metric. - Add "Aggregation Temporality" and "Monotonic" fields to the metric table - Add enum values to Resource attributes
- Loading branch information
Showing
48 changed files
with
15,329 additions
and
1,680 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: cmd/mdatagen | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Improve generated documentation | ||
|
||
# One or more tracking issues related to the change | ||
issues: [16556] |
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
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 |
---|---|---|
@@ -1,43 +1,88 @@ | ||
{{- 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.Aggregated }} |{{ end }} | ||
{{- if $metric.Data.HasMonotonic }} {{ $metric.Data.Monotonic }} |{{ end }} | ||
|
||
{{- if $metric.Attributes }} | ||
|
||
#### Attributes | ||
|
||
| Name | Description | Values | | ||
| ---- | ----------- | ------ | | ||
{{- range $metric.Attributes }} | ||
{{- $attribute := . | attributeInfo }} | ||
| {{ . | attributeKey }} | {{ $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.) | ||
|
||
# {{ .Name }} | ||
|
||
## Metrics | ||
## 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.IsEnabled }} | ||
|
||
These are the metrics available for this scraper. | ||
{{ template "metric-documenation" $metricName }} | ||
|
||
| Name | Description | Unit | Type | Attributes | | ||
| ---- | ----------- | ---- | ---- | ---------- | | ||
{{- range $metricName, $metricInfo := .Metrics }} | ||
| {{ if $metricInfo.IsEnabled }}**{{ end }}{{ $metricName }}{{ if $metricInfo.IsEnabled }}** | ||
{{- end }} | {{ $metricInfo.Description }}{{ if $metricInfo.ExtendedDocumentation }} {{ $metricInfo.ExtendedDocumentation }}{{ end }} | {{ $metricInfo.Unit }} | {{ $metricInfo.Data.Type }}({{ $metricInfo.Data.MetricValueType }}) | <ul> | ||
{{- range $index, $attributeName := $metricInfo.Attributes }} <li>{{ $attributeName }}</li> {{- end }} </ul> | | ||
{{- end }} | ||
{{- end }} | ||
|
||
## Optional Metrics | ||
|
||
**Highlighted metrics** are emitted by default. Other metrics are optional and not emitted by default. | ||
Any metric can be enabled or disabled with the following scraper configuration: | ||
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|false> | ||
enabled: true | ||
``` | ||
|
||
{{- if .ResourceAttributes }} | ||
{{- range $metricName, $metric := .Metrics }} | ||
{{- if $metric.IsEnabled }} | ||
|
||
## Resource attributes | ||
{{ template "metric-documenation" $metricName }} | ||
|
||
| Name | Description | Type | | ||
| ---- | ----------- | ---- | | ||
{{- range $attributeName, $attributeInfo := .ResourceAttributes }} | ||
| {{ $attributeName }} | {{ $attributeInfo.Description }} | {{ $attributeInfo.Type }} | | ||
{{- end }} | ||
{{- end }} | ||
|
||
## Metric attributes | ||
{{- if .ResourceAttributes }} | ||
|
||
## Resource Attributes | ||
|
||
| Name | Description | Values | | ||
| ---- | ----------- | ------ | | ||
{{- range $attributeName, $attributeInfo := .Attributes }} | ||
| {{ $attributeName }}{{- if $attributeInfo.Value }} ({{ $attributeInfo.Value }}){{- end}} | {{ $attributeInfo.Description }} | {{ stringsJoin $attributeInfo.Enum ", " }} | | ||
{{- range $attributeName, $attribute := .ResourceAttributes }} | ||
| {{ $attributeName }} | {{ $attribute.Description }} | | ||
{{- if $attribute.Enum }} {{ $attribute.Type }}: ``{{ stringsJoin $attribute.Enum "``, ``" }}``{{ else }} Any {{ $attribute.Type }}{{ end }} | | ||
{{- end }} | ||
|
||
{{- end }} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.