-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add config schemas for comp/otelcol components #50408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5308ef2
Add config schemas for comp/otelcol components
truthbk bff918d
Address code review feedback on comp/otelcol config schemas
truthbk 245086a
Git push hooks updated BUILD.bazel
truthbk e21c4a9
Resolve dangling TagCardinality ref in infraattributesprocessor schema
truthbk ae19457
Convert dogtelextension trailing comments to godoc-style
truthbk 9862911
Revert "Git push hooks updated BUILD.bazel"
truthbk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,48 @@ | ||
| # Settings for upstream's schemagen tool. | ||
| # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/cmd/schemagen | ||
| # | ||
| # To regenerate a component's config.schema.yaml: | ||
| # | ||
| # 1. Build the tool from a local checkout of opentelemetry-collector-contrib: | ||
| # (cd /path/to/opentelemetry-collector-contrib/cmd/schemagen && go build -o /tmp/schemagen .) | ||
| # 2. Run it against the component's directory (the one containing config.go and metadata.yaml): | ||
| # /tmp/schemagen comp/otelcol/<component>/... | ||
| # | ||
| # The tool walks up from CWD to find this file, so it must remain at or above | ||
| # every component path it generates schemas for. See ./README.md and individual | ||
| # component metadata.yaml files for context. | ||
| # | ||
| # Known limitation: schemagen treats every Go-embedded field as squashed, | ||
| # regardless of the explicit mapstructure tag value. Components with embedded | ||
| # pointer fields (e.g. ddflareextension's *confighttp.ServerConfig) or embedded | ||
| # fields with a non-squash mapstructure key (e.g. serializerexporter's | ||
| # configtls.ClientConfig with mapstructure:"tls") need hand-tuning after | ||
| # regeneration. | ||
|
|
||
| namespace: github.com/DataDog/datadog-agent | ||
| mappings: | ||
| time: | ||
| Time: | ||
| schemaType: string | ||
| format: date-time | ||
| skipAnnotation: true | ||
| Duration: | ||
| schemaType: string | ||
| format: duration | ||
| skipAnnotation: true | ||
| go.opentelemetry.io/collector/component: | ||
| ID: | ||
| schemaType: string | ||
| github.com/DataDog/datadog-agent/comp/core/tagger/types: | ||
| # TagCardinality is a typed int (iota: 0=low, 1=orchestrator, 2=high, | ||
| # 3=none, 4=checks-config). YAML accepts the integer form; there is no | ||
| # UnmarshalText hook today, so the schema mirrors that. | ||
| TagCardinality: | ||
| schemaType: integer | ||
| allowedRefs: | ||
| - go.opentelemetry.io/collector | ||
| - github.com/open-telemetry/opentelemetry-collector-contrib | ||
| - github.com/DataDog/datadog-agent | ||
| componentOverrides: | ||
| exporter/serializer: | ||
| configName: ExporterConfig |
This file contains hidden or 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,5 @@ | ||
| description: Config has the configuration for the extension enabling the health check extension, used to report the health status of the service. | ||
| type: object | ||
| allOf: | ||
| - x-pointer: true | ||
| $ref: go.opentelemetry.io/collector/config/confighttp.server_config |
This file contains hidden or 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,9 @@ | ||
| type: ddflare | ||
| display_name: Datadog Flare Extension | ||
|
|
||
| status: | ||
| class: extension | ||
| stability: | ||
| beta: [extension] | ||
| codeowners: | ||
| active: [DataDog/opentelemetry] |
This file contains hidden or 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 hidden or 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,30 @@ | ||
| $defs: | ||
| profiler_options: | ||
| description: ProfilerOptions defines settings relevant to the profiler. | ||
| type: object | ||
| properties: | ||
| env: | ||
| description: 'Env the profiler will report with. Default: none' | ||
| type: string | ||
| period: | ||
| description: 'Period in seconds the profiler will report with. Default: 60s' | ||
| type: integer | ||
| profile_types: | ||
| description: ProfileTypes specifies additional profile types to enable. supported values are blockprofile, mutexprofile and goroutineprofile. By default CPU and Heap profiles are enabled. | ||
| type: array | ||
| items: | ||
| type: string | ||
| service: | ||
| description: 'Service the profiler will report with. Default: BuildInfo.Command (e.g. otel-agent)' | ||
| type: string | ||
| version: | ||
| description: 'Version the profiler will report with. Default: BuildInfo.Version (e.g. v0.117.0)' | ||
| type: string | ||
| description: Config contains the config of the profiler. | ||
| type: object | ||
| properties: | ||
| endpoint: | ||
| description: 'Endpoint is the local port the profiling HTTP server listens on; used as "localhost:<endpoint>". Default: "7501"' | ||
| type: string | ||
| profiler_options: | ||
| $ref: profiler_options |
This file contains hidden or 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,9 @@ | ||
| type: ddprofiling | ||
| display_name: Datadog Profiling Extension | ||
|
|
||
| status: | ||
| class: extension | ||
| stability: | ||
| development: [extension] | ||
| codeowners: | ||
| active: [DataDog/opentelemetry] |
This file contains hidden or 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 hidden or 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,58 @@ | ||
| description: Config defines the configuration for the dogtelextension | ||
| type: object | ||
| properties: | ||
| enable_metadata_collection: | ||
| description: EnableMetadataCollection toggles metadata collection. Pointer so that nil ("not set") is distinguishable from an explicit false, allowing NewConfigComponent to leave the DD agent default (true) intact when the field is absent. | ||
| x-pointer: true | ||
| type: boolean | ||
| enable_tagger_server: | ||
| description: EnableTaggerServer enables the tagger gRPC server. | ||
| type: boolean | ||
| hostname: | ||
| description: Hostname overrides the agent hostname used in standalone mode. Maps to the "hostname" DD agent config key. When empty the agent resolves the hostname automatically. | ||
| type: string | ||
| kubelet_tls_verify: | ||
| description: KubeletTLSVerify controls TLS verification for the kubelet client. nil keeps the DD agent default (true). | ||
| x-pointer: true | ||
| type: boolean | ||
| kubernetes_http_kubelet_port: | ||
| description: KubernetesHTTPKubeletPort is the kubelet HTTP port. 0 uses the agent default (10255). | ||
| type: integer | ||
| kubernetes_https_kubelet_port: | ||
| description: KubernetesHTTPSKubeletPort is the kubelet HTTPS port. 0 uses the agent default (10250). | ||
| type: integer | ||
| kubernetes_kubelet_host: | ||
| description: KubernetesKubeletHost is the kubelet host used for K8s tag enrichment in standalone mode (e.g. "status.hostIP" or an explicit IP). When the otel-agent runs on a Kubernetes node these settings let the workloadmeta kubelet collector and the local tagger reach the kubelet API without needing a separate datadog.yaml. | ||
| type: string | ||
| metadata_interval: | ||
| description: MetadataInterval is the metadata collection interval, in seconds. 0 uses the agent default (1800). | ||
| type: integer | ||
| secret_backend_arguments: | ||
| description: SecretBackendArguments are extra CLI arguments passed to the secret resolver binary. | ||
| type: array | ||
| items: | ||
| type: string | ||
| secret_backend_command: | ||
| description: SecretBackendCommand is the path to the secret resolver binary (standalone mode). Maps to the "secret_backend_command" DD agent config key so ENC[] handles in the OTel config can be resolved without a separate datadog.yaml file. | ||
| type: string | ||
| secret_backend_output_max_size: | ||
| description: SecretBackendOutputMaxSize is the maximum secret-resolver output size, in bytes. 0 uses the agent default. | ||
| type: integer | ||
| secret_backend_timeout: | ||
| description: SecretBackendTimeout is the secret-resolver execution timeout, in seconds. 0 uses the agent default (30s). | ||
| type: integer | ||
| standalone_mode: | ||
| description: StandaloneMode controls whether the extension runs in standalone mode, enabling secrets resolution and other agent features. Typically set via the DD_OTEL_STANDALONE environment variable. | ||
| type: boolean | ||
| tagger_max_concurrent_sync: | ||
| description: 'TaggerMaxConcurrentSync is the maximum number of concurrent tag stream subscribers. Default: 5.' | ||
| type: integer | ||
| tagger_max_message_size: | ||
| description: 'TaggerMaxMessageSize is the maximum gRPC message size in bytes. Default: 4MB.' | ||
| type: integer | ||
| tagger_server_addr: | ||
| description: 'TaggerServerAddr is the address the tagger server binds to. Default: localhost.' | ||
| type: string | ||
| tagger_server_port: | ||
| description: TaggerServerPort is the port the tagger server binds to. 0 auto-assigns. | ||
| type: integer | ||
This file contains hidden or 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,9 @@ | ||
| type: dogtel | ||
| display_name: Datadog Telemetry Extension | ||
|
|
||
| status: | ||
| class: extension | ||
| stability: | ||
| beta: [extension] | ||
| codeowners: | ||
| active: [DataDog/opentelemetry] |
20 changes: 20 additions & 0 deletions
20
comp/otelcol/otlp/components/exporter/datadogexporter/README.md
This file contains hidden or 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,20 @@ | ||
| # Datadog Exporter | ||
|
|
||
| This package provides the Datadog exporter factory used inside the Datadog | ||
| Distribution of OpenTelemetry (DDOT) Collector. It builds on top of the | ||
| [`serializerexporter`](../serializerexporter), [`logsagentexporter`](../logsagentexporter), | ||
| and the trace agent component to send metrics, logs, and traces (plus APM | ||
| stats) to Datadog using the agent's internal pipelines. | ||
|
|
||
| ## Configuration | ||
|
|
||
| This factory does not define its own configuration struct. It accepts the | ||
| same configuration as the upstream Datadog exporter in | ||
| [`opentelemetry-collector-contrib`](https://github.com/open-telemetry/opentelemetry-collector-contrib), | ||
| which is the `Config` type from | ||
| [`pkg/datadog/config`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/datadog/config). | ||
|
|
||
| The corresponding configuration schema is published upstream at | ||
| [`pkg/datadog/config/config.schema.yaml`](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/datadog/config/config.schema.yaml). | ||
| That single file is the source of truth for every option this exporter | ||
| accepts (API, host metadata, metrics, traces, logs, retry, queue, etc.). |
9 changes: 9 additions & 0 deletions
9
comp/otelcol/otlp/components/exporter/logsagentexporter/config.schema.yaml
This file contains hidden or 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,9 @@ | ||
| description: Config defines configuration for the logs agent exporter. | ||
| type: object | ||
| properties: | ||
| host_metadata: | ||
| description: HostMetadata defines the host metadata specific configuration | ||
| $ref: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config.host_metadata_config | ||
| sending_queue: | ||
| x-optional: true | ||
| $ref: go.opentelemetry.io/collector/exporter/exporterhelper.queue_batch_config |
This file contains hidden or 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
9 changes: 9 additions & 0 deletions
9
comp/otelcol/otlp/components/exporter/logsagentexporter/metadata.yaml
This file contains hidden or 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,9 @@ | ||
| type: logsagent | ||
| display_name: Datadog Logs Agent Exporter | ||
|
|
||
| status: | ||
| class: exporter | ||
| stability: | ||
| stable: [logs] | ||
| codeowners: | ||
| active: [DataDog/opentelemetry] |
32 changes: 32 additions & 0 deletions
32
comp/otelcol/otlp/components/exporter/serializerexporter/config.schema.yaml
This file contains hidden or 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,32 @@ | ||
| $defs: | ||
| metrics_config: | ||
| description: MetricsConfig defines the metrics exporter specific configuration options | ||
| type: object | ||
| properties: | ||
| apm_stats_receiver_addr: | ||
| description: APMStatsReceiverAddr is the address to send APM stats to. | ||
| type: string | ||
| tags: | ||
| description: Tags is a comma-separated list of tags to add to all metrics. | ||
| type: string | ||
| allOf: | ||
| - $ref: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config.metrics_config | ||
| description: ExporterConfig defines configuration for the serializer exporter. | ||
| type: object | ||
| properties: | ||
| api: | ||
| description: API defines the Datadog API configuration. It is useful for OSS OpenTelemetry Collector or to use the serializer exporter with the OCB. | ||
| $ref: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config.api_config | ||
| host_metadata: | ||
| description: HostMetadataConfig defines the host metadata related configuration. | ||
| $ref: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config.host_metadata_config | ||
| metrics: | ||
| $ref: metrics_config | ||
| sending_queue: | ||
| x-optional: true | ||
| $ref: go.opentelemetry.io/collector/exporter/exporterhelper.queue_batch_config | ||
| tls: | ||
| $ref: go.opentelemetry.io/collector/config/configtls.client_config | ||
| allOf: | ||
| - $ref: go.opentelemetry.io/collector/exporter/exporterhelper.timeout_config | ||
| - $ref: go.opentelemetry.io/collector/config/confighttp.client_config |
9 changes: 9 additions & 0 deletions
9
comp/otelcol/otlp/components/exporter/serializerexporter/metadata.yaml
This file contains hidden or 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,9 @@ | ||
| type: serializer | ||
| display_name: Datadog Serializer Exporter | ||
|
|
||
| status: | ||
| class: exporter | ||
| stability: | ||
| stable: [metrics] | ||
| codeowners: | ||
| active: [DataDog/opentelemetry] |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not yet familiar with used schema generation tool like cmd/schemagen
Just noticed that fields specified in schema has no comments, while in source code there are:
unf. schemagen reads field.Doc only — that's the Go AST's doc comment (the comment block above the field). It does not read field.Comment, which is the inline/trailing comment on the same line.
So for code like this:
The
// seconds; 0 = ...isfield.Comment(inline), not field.Doc — schemagen ignores it entirely. But if it were written as:That becomes field.Doc and schemagen would pick it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really want to make changes to the go code here; but you're right, it's a good opportunity to allow the tool to pick up on this valuable configuration context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed your feedback.