Files
8e9c14c012 [pkg/scraperhelper] Switch scraper/scraperhelper to schema-based configuration (#15318)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Switch `scraper/scraperhelper` `ControllerConfig` to schema-based
generated configuration.

This adds metadata-driven config generation for the scraper controller
settings, publishes the reusable `controller_config` schema from
`pkg/scraperhelper`, and updates the mdatagen sample scraper to embed
that exported config via schema reference.

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #15258

<!--Describe what testing was performed and which tests were added.-->
#### Testing

Added usage example to `samplescraper` test component.

---------

Co-authored-by: Dmitry Anoshin <[email protected]>
2026-05-20 23:06:25 +00:00

31 lines
1.4 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "go.opentelemetry.io/collector/scraper/scraperhelper/internal/controller",
"title": "pkg/scraperhelper/controller",
"$defs": {
"controller_config": {
"description": "ControllerConfig defines common settings for a scraper controller configuration. Scraper controller receivers can embed this struct, instead of receiver.Settings, and extend it with more fields if needed.",
"type": "object",
"properties": {
"collection_interval": {
"description": "CollectionInterval sets how frequently the scraper should be called and used as the context timeout to ensure that scrapers don't exceed the interval.",
"type": "string",
"default": "1m",
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
},
"initial_delay": {
"description": "InitialDelay sets the initial start delay for the scraper, any non positive value is assumed to be immediately.",
"type": "string",
"default": "1s",
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
},
"timeout": {
"description": "Timeout is an optional value used to set scraper's context deadline.",
"type": "string",
"default": 0,
"pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
}
}
}
}
}