Skip to content

[OTel] --set should merge with existing config #10267

@pickypg

Description

@pickypg

I added a few tests to exemplify this scenario:

c652afc

But, imagine that you have a configuration that looks like:

receivers:
metricbeatreceiver:
metricbeat:
modules:
# Metrics
- module: autoops_es
hosts: ${env:AUTOOPS_ES_URL}
period: 10s
metricsets:
- cat_shards
- cluster_health
- cluster_settings
- license
- node_stats
- tasks_management
# Templates
- module: autoops_es
hosts: ${env:AUTOOPS_ES_URL}
period: 24h
metricsets:
- cat_template
- component_template
- index_template

Ideally, we should be able to add ssl.verification_mode to "both" modules by a simply:

--set "receivers::metricbeatreceiver::metricbeat::modules=[{ ssl: { verification_mode: none } }, { ssl: { verification_mode: none } }]"

This is parsed, but it ultimately fails because it overwrites the existing modules. Separately, it seems like we should be able to manipulate the array directly:

--set "receivers::metricbeatreceiver::metricbeat::modules::0::ssl::verification_mode=none" \
--set "receivers::metricbeatreceiver::metricbeat::modules::1::ssl::verification_mode=none"

As a result, the only way to add or change settings within that array is to provide all settings at the same time:

--set 'receivers::metricbeatreceiver::metricbeat::modules=[{module: autoops_es, hosts: "${env:AUTOOPS_ES_URL}", period: 10s, metricsets: [cat_shards, cluster_health, cluster_settings, license, node_stats, tasks_management], ssl: { verification_mode: none } }, {module: autoops_es, hosts: "${env:AUTOOPS_ES_URL}", period: 24h, metricsets: [cat_template, component_template, index_template], ssl: { verification_mode: none } }]'

The way that --set is described, it seems like merging is the desired behavior rather than replacement. And, the way that I would also like to use it from the outside is to append. If I want to overwrite, I can change the relevant key(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions