Skip to content

Commit fbd9a99

Browse files
author
Alex Boten
authored
[receiver/dockerstats] use generated status header (#22767)
This PR updates the component to generate the status table using mdatagen. Linked issue: #21213 Signed-off-by: Alex Boten <[email protected]>
1 parent a74f8e5 commit fbd9a99

File tree

7 files changed

+40
-26
lines changed

7 files changed

+40
-26
lines changed

receiver/dockerstatsreceiver/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Docker Stats Receiver
22

3-
| Status | |
4-
| ------------------------ |-------------------------------|
5-
| Stability | [alpha] |
6-
| Supported pipeline types | metrics |
7-
| Distributions | [contrib], [observiq], [sumo] |
3+
<!-- status autogenerated section -->
4+
| Status | |
5+
| ------------- |-----------|
6+
| Stability | [alpha]: metrics |
7+
| Distributions | [contrib], [observiq], [sumo] |
8+
9+
[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha
10+
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
11+
[observiq]: https://github.com/observIQ/observiq-otel-collector
12+
[sumo]: https://github.com/SumoLogic/sumologic-otel-collector
13+
<!-- end autogenerated section -->
814

915
The Docker Stats receiver queries the local Docker daemon's container stats API for
1016
all desired running containers on a configured interval. These stats are for container
@@ -64,11 +70,6 @@ receivers:
6470
The full list of settings exposed for this receiver are documented [here](./config.go)
6571
with detailed sample configurations [here](./testdata/config.yaml).
6672
67-
[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha
68-
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
69-
[observiq]: https://github.com/observIQ/observiq-otel-collector
70-
[sumo]: https://github.com/SumoLogic/sumologic-otel-collector
71-
7273
### Migrating from ScraperV1 to ScraperV2
7374
7475
*Note: These changes are now in effect and ScraperV1 have been removed as of v0.71.*

receiver/dockerstatsreceiver/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ func TestLoadConfig(t *testing.T) {
2727
expected component.Config
2828
}{
2929
{
30-
id: component.NewIDWithName(typeStr, ""),
30+
id: component.NewIDWithName(metadata.Type, ""),
3131
expected: createDefaultConfig(),
3232
},
3333
{
34-
id: component.NewIDWithName(typeStr, "allsettings"),
34+
id: component.NewIDWithName(metadata.Type, "allsettings"),
3535
expected: &Config{
3636
ScraperControllerSettings: scraperhelper.ScraperControllerSettings{
3737
CollectionInterval: 2 * time.Second,

receiver/dockerstatsreceiver/documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)
22

3-
# dockerstatsreceiver
3+
# docker_stats
44

55
## Default Metrics
66

receiver/dockerstatsreceiver/factory.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ import (
1616
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver/internal/metadata"
1717
)
1818

19-
const (
20-
typeStr = "docker_stats"
21-
stability = component.StabilityLevelAlpha
22-
)
23-
2419
var _ = featuregate.GlobalRegistry().MustRegister(
2520
"receiver.dockerstats.useScraperV2",
2621
featuregate.StageStable,
@@ -31,13 +26,13 @@ var _ = featuregate.GlobalRegistry().MustRegister(
3126

3227
func NewFactory() rcvr.Factory {
3328
return rcvr.NewFactory(
34-
typeStr,
29+
metadata.Type,
3530
createDefaultConfig,
36-
rcvr.WithMetrics(createMetricsReceiver, stability))
31+
rcvr.WithMetrics(createMetricsReceiver, metadata.MetricsStability))
3732
}
3833

3934
func createDefaultConfig() component.Config {
40-
scs := scraperhelper.NewDefaultScraperControllerSettings(typeStr)
35+
scs := scraperhelper.NewDefaultScraperControllerSettings(metadata.Type)
4136
scs.CollectionInterval = 10 * time.Second
4237
return &Config{
4338
ScraperControllerSettings: scs,
@@ -57,7 +52,7 @@ func createMetricsReceiver(
5752
dockerConfig := config.(*Config)
5853
dsr := newReceiver(params, dockerConfig)
5954

60-
scrp, err := scraperhelper.NewScraper(typeStr, dsr.scrapeV2, scraperhelper.WithStart(dsr.start))
55+
scrp, err := scraperhelper.NewScraper(metadata.Type, dsr.scrapeV2, scraperhelper.WithStart(dsr.start))
6156
if err != nil {
6257
return nil, err
6358
}

receiver/dockerstatsreceiver/internal/metadata/generated_config.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/dockerstatsreceiver/internal/metadata/generated_status.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/dockerstatsreceiver/metadata.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
type: dockerstatsreceiver
1+
type: docker_stats
2+
3+
status:
4+
class: receiver
5+
stability:
6+
alpha: [metrics]
7+
distributions: [contrib, observiq, sumo]
28

39
sem_conv_version: 1.6.1
410

0 commit comments

Comments
 (0)