diff --git a/cmd/mdatagen/documentation.tmpl b/cmd/mdatagen/documentation.tmpl
index 97997d9f7c55..8f48ee918de5 100644
--- a/cmd/mdatagen/documentation.tmpl
+++ b/cmd/mdatagen/documentation.tmpl
@@ -9,7 +9,12 @@ These are the metrics available for this scraper.
| Name | Description | Unit | Type | Attributes |
| ---- | ----------- | ---- | ---- | ---------- |
{{- range $metricName, $metricInfo := .Metrics }}
+{{- if $metricInfo.ExtendedDocumentation }}
+| {{ $metricName }} | {{ $metricInfo.Description }} {{ $metricInfo.ExtendedDocumentation }} | {{ $metricInfo.Unit }} | {{ $metricInfo.Data.Type }} |
+{{ else }}
| {{ $metricName }} | {{ $metricInfo.Description }} | {{ $metricInfo.Unit }} | {{ $metricInfo.Data.Type }} |
+{{- end }}
+
{{- range $index, $labelName := $metricInfo.Labels }} - {{ $labelName }}
{{- end }}
|
{{- end }}
diff --git a/cmd/mdatagen/loader.go b/cmd/mdatagen/loader.go
index 5ada0cf226d6..086699207ae1 100644
--- a/cmd/mdatagen/loader.go
+++ b/cmd/mdatagen/loader.go
@@ -42,6 +42,11 @@ func (mn labelName) Render() (string, error) {
type metric struct {
// Description of the metric.
Description string `validate:"required,notblank"`
+
+ // ExtendedDocumentation of the metric. If specified, this will
+ // be appended to the description used in generated documentation.
+ ExtendedDocumentation string `yaml:"extended_documentation"`
+
// Unit of the metric.
Unit string `yaml:"unit"`
diff --git a/cmd/mdatagen/loader_test.go b/cmd/mdatagen/loader_test.go
index eb0c5d83947a..fcfe5df16b3d 100644
--- a/cmd/mdatagen/loader_test.go
+++ b/cmd/mdatagen/loader_test.go
@@ -38,6 +38,7 @@ labels:
metrics:
system.cpu.time:
description: Total CPU seconds broken down by different states.
+ extended_documentation: Additional information on CPU Time can be found [here](https://en.wikipedia.org/wiki/CPU_time).
unit: s
data:
type: sum
@@ -95,8 +96,9 @@ func Test_loadMetadata(t *testing.T) {
Value: "state"}},
Metrics: map[metricName]metric{
"system.cpu.time": {
- Description: "Total CPU seconds broken down by different states.",
- Unit: "s",
+ Description: "Total CPU seconds broken down by different states.",
+ ExtendedDocumentation: "Additional information on CPU Time can be found [here](https://en.wikipedia.org/wiki/CPU_time).",
+ Unit: "s",
Data: &sum{
Aggregated: Aggregated{Aggregation: "cumulative"},
Mono: Mono{Monotonic: true},
diff --git a/cmd/mdatagen/main_test.go b/cmd/mdatagen/main_test.go
index d4e18d6679f7..3182a9dfaf5f 100644
--- a/cmd/mdatagen/main_test.go
+++ b/cmd/mdatagen/main_test.go
@@ -29,6 +29,7 @@ name: metricreceiver
metrics:
system.cpu.time:
description: Total CPU seconds broken down by different states.
+ extended_description: Additional information on CPU Time can be found [here](https://en.wikipedia.org/wiki/CPU_time).
unit: s
data:
type: sum
@@ -77,6 +78,7 @@ func Test_runContents(t *testing.T) {
} else {
require.NoError(t, err)
require.FileExists(t, path.Join(tmpdir, "internal/metadata/generated_metrics.go"))
+ require.FileExists(t, path.Join(tmpdir, "documentation.md"))
}
})
}
diff --git a/receiver/httpdreceiver/documentation.md b/receiver/httpdreceiver/documentation.md
index 47b39361a59b..933ec3d4b178 100644
--- a/receiver/httpdreceiver/documentation.md
+++ b/receiver/httpdreceiver/documentation.md
@@ -8,17 +8,19 @@ These are the metrics available for this scraper.
| Name | Description | Unit | Type | Attributes |
| ---- | ----------- | ---- | ---- | ---------- |
-| httpd.current_connections | The number of active connections currently attached to the HTTP server | connections | Sum | |
-| httpd.requests | The number of requests serviced by the HTTP server per second | 1 | Sum | |
-| httpd.scoreboard | The number of connections in each state | scoreboard | Sum | - server_name
- scoreboard_state
|
-| httpd.traffic | Total HTTP server traffic | By | Sum | |
-| httpd.uptime | The amount of time that the server has been running in seconds | s | Sum | |
-| httpd.workers | The number of workers currently attached to the HTTP server | connections | Sum | - server_name
- workers_state
|
+| httpd.current_connections | The number of active connections currently attached to the HTTP server. | connections | Sum | |
+| httpd.requests | The number of requests serviced by the HTTP server per second. | 1 | Sum | |
+| httpd.scoreboard | The number of connections in each state. The apache scoreboard is an encoded representation of the state of all the server's workers. This metric decodes the scoreboard and presents a count of workers in each state. Additional details can be found [here](https://support.cpanel.net/hc/en-us/articles/360052040234-Understanding-the-Apache-scoreboard).
+ | scoreboard | Sum |
+ - server_name
- scoreboard_state
|
+| httpd.traffic | Total HTTP server traffic. | By | Sum | |
+| httpd.uptime | The amount of time that the server has been running in seconds. | s | Sum | |
+| httpd.workers | The number of workers currently attached to the HTTP server. | connections | Sum | - server_name
- workers_state
|
## Attributes
| Name | Description |
| ---- | ----------- |
-| scoreboard_state | The state of a connection |
-| server_name | The name of the Apache HTTP server |
-| workers_state | The state of workers |
\ No newline at end of file
+| scoreboard_state | The state of a connection. |
+| server_name | The name of the Apache HTTP server. |
+| workers_state | The state of workers. |
\ No newline at end of file
diff --git a/receiver/httpdreceiver/internal/metadata/generated_metrics.go b/receiver/httpdreceiver/internal/metadata/generated_metrics.go
index 2d7567ae1c2b..c16dc595fe26 100644
--- a/receiver/httpdreceiver/internal/metadata/generated_metrics.go
+++ b/receiver/httpdreceiver/internal/metadata/generated_metrics.go
@@ -95,7 +95,7 @@ var Metrics = &metricStruct{
"httpd.current_connections",
func(metric pdata.Metric) {
metric.SetName("httpd.current_connections")
- metric.SetDescription("The number of active connections currently attached to the HTTP server")
+ metric.SetDescription("The number of active connections currently attached to the HTTP server.")
metric.SetUnit("connections")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(false)
@@ -106,7 +106,7 @@ var Metrics = &metricStruct{
"httpd.requests",
func(metric pdata.Metric) {
metric.SetName("httpd.requests")
- metric.SetDescription("The number of requests serviced by the HTTP server per second")
+ metric.SetDescription("The number of requests serviced by the HTTP server per second.")
metric.SetUnit("1")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(true)
@@ -117,7 +117,7 @@ var Metrics = &metricStruct{
"httpd.scoreboard",
func(metric pdata.Metric) {
metric.SetName("httpd.scoreboard")
- metric.SetDescription("The number of connections in each state")
+ metric.SetDescription("The number of connections in each state.")
metric.SetUnit("scoreboard")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(false)
@@ -128,7 +128,7 @@ var Metrics = &metricStruct{
"httpd.traffic",
func(metric pdata.Metric) {
metric.SetName("httpd.traffic")
- metric.SetDescription("Total HTTP server traffic")
+ metric.SetDescription("Total HTTP server traffic.")
metric.SetUnit("By")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(true)
@@ -139,7 +139,7 @@ var Metrics = &metricStruct{
"httpd.uptime",
func(metric pdata.Metric) {
metric.SetName("httpd.uptime")
- metric.SetDescription("The amount of time that the server has been running in seconds")
+ metric.SetDescription("The amount of time that the server has been running in seconds.")
metric.SetUnit("s")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(true)
@@ -150,7 +150,7 @@ var Metrics = &metricStruct{
"httpd.workers",
func(metric pdata.Metric) {
metric.SetName("httpd.workers")
- metric.SetDescription("The number of workers currently attached to the HTTP server")
+ metric.SetDescription("The number of workers currently attached to the HTTP server.")
metric.SetUnit("connections")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(false)
@@ -165,11 +165,11 @@ var M = Metrics
// Labels contains the possible metric labels that can be used.
var Labels = struct {
- // ScoreboardState (The state of a connection)
+ // ScoreboardState (The state of a connection.)
ScoreboardState string
- // ServerName (The name of the Apache HTTP server)
+ // ServerName (The name of the Apache HTTP server.)
ServerName string
- // WorkersState (The state of workers)
+ // WorkersState (The state of workers.)
WorkersState string
}{
"state",
diff --git a/receiver/httpdreceiver/metadata.yaml b/receiver/httpdreceiver/metadata.yaml
index 22777005956a..e927c8513feb 100644
--- a/receiver/httpdreceiver/metadata.yaml
+++ b/receiver/httpdreceiver/metadata.yaml
@@ -2,16 +2,16 @@ name: httpdreceiver
labels:
server_name:
- description: The name of the Apache HTTP server
+ description: The name of the Apache HTTP server.
workers_state:
value: state
- description: The state of workers
+ description: The state of workers.
enum:
- busy
- idle
scoreboard_state:
value: state
- description: The state of a connection
+ description: The state of a connection.
enum:
- open
- waiting
@@ -27,7 +27,7 @@ labels:
metrics:
httpd.uptime:
- description: The amount of time that the server has been running in seconds
+ description: The amount of time that the server has been running in seconds.
unit: s
data:
type: sum
@@ -35,7 +35,7 @@ metrics:
aggregation: cumulative
labels: [ server_name ]
httpd.current_connections:
- description: The number of active connections currently attached to the HTTP server
+ description: The number of active connections currently attached to the HTTP server.
unit: connections
data:
type: sum
@@ -43,7 +43,7 @@ metrics:
aggregation: cumulative
labels: [ server_name ]
httpd.workers:
- description: The number of workers currently attached to the HTTP server
+ description: The number of workers currently attached to the HTTP server.
unit: connections
data:
type: sum
@@ -51,7 +51,7 @@ metrics:
aggregation: cumulative
labels: [ server_name, workers_state]
httpd.requests:
- description: The number of requests serviced by the HTTP server per second
+ description: The number of requests serviced by the HTTP server per second.
unit: 1
data:
type: sum
@@ -59,7 +59,7 @@ metrics:
aggregation: cumulative
labels: [ server_name ]
httpd.traffic:
- description: Total HTTP server traffic
+ description: Total HTTP server traffic.
unit: By
data:
type: sum
@@ -67,7 +67,11 @@ metrics:
aggregation: cumulative
labels: [ server_name ]
httpd.scoreboard:
- description: The number of connections in each state
+ description: The number of connections in each state.
+ extended_documentation: >
+ The apache scoreboard is an encoded representation of the state of all the server's workers.
+ This metric decodes the scoreboard and presents a count of workers in each state.
+ Additional details can be found [here](https://support.cpanel.net/hc/en-us/articles/360052040234-Understanding-the-Apache-scoreboard).
unit: scoreboard
data:
type: sum
diff --git a/receiver/httpdreceiver/testdata/scraper/expected.json b/receiver/httpdreceiver/testdata/scraper/expected.json
index ff39f339c33f..5485cfca5924 100644
--- a/receiver/httpdreceiver/testdata/scraper/expected.json
+++ b/receiver/httpdreceiver/testdata/scraper/expected.json
@@ -10,7 +10,7 @@
"metrics": [
{
"name": "httpd.uptime",
- "description": "The amount of time that the server has been running in seconds",
+ "description": "The amount of time that the server has been running in seconds.",
"unit": "s",
"sum": {
"dataPoints": [
@@ -33,7 +33,7 @@
},
{
"name": "httpd.current_connections",
- "description": "The number of active connections currently attached to the HTTP server",
+ "description": "The number of active connections currently attached to the HTTP server.",
"unit": "connections",
"sum": {
"dataPoints": [
@@ -56,7 +56,7 @@
},
{
"name": "httpd.workers",
- "description": "The number of workers currently attached to the HTTP server",
+ "description": "The number of workers currently attached to the HTTP server.",
"unit": "connections",
"sum": {
"dataPoints": [
@@ -103,7 +103,7 @@
},
{
"name": "httpd.requests",
- "description": "The number of requests serviced by the HTTP server per second",
+ "description": "The number of requests serviced by the HTTP server per second.",
"unit": "1",
"sum": {
"dataPoints": [
@@ -126,7 +126,7 @@
},
{
"name": "httpd.traffic",
- "description": "Total HTTP server traffic",
+ "description": "Total HTTP server traffic.",
"unit": "By",
"sum": {
"dataPoints": [
@@ -149,7 +149,7 @@
},
{
"name": "httpd.scoreboard",
- "description": "The number of connections in each state",
+ "description": "The number of connections in each state.",
"unit": "scoreboard",
"sum": {
"dataPoints": [