Skip to content

feat: add config command flag --render-otel to print full otel config #184

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 3 commits into from
Apr 4, 2025

Conversation

obs-gh-mattcotter
Copy link
Collaborator

@obs-gh-mattcotter obs-gh-mattcotter commented Apr 2, 2025

Description

Add the flags --render-otel and --render-otel-details to the config command to print full otel config. This short version is modeled after the otelcol print command, the long version was modeled after the startup command.

Ex:

$ ./observe-agent config --render-otel | tail -n 40
                - debug
            processors:
                - filter/count
            receivers:
                - count
        metrics/forward:
            exporters:
                - prometheusremotewrite/observe
            processors:
                - resourcedetection
                - resourcedetection/cloud
                - deltatocumulative
                - batch
            receivers:
                - otlp
        metrics/host_monitoring_host:
            exporters:
                - prometheusremotewrite/observe
            processors:
                - memory_limiter
                - resourcedetection
                - resourcedetection/cloud
                - batch
            receivers:
                - hostmetrics/host-monitoring-host
        traces/forward:
            exporters:
                - otlphttp/observetracing
            processors:
                - resourcedetection
                - resourcedetection/cloud
            receivers:
                - otlp
    telemetry:
        logs:
            level: INFO
        metrics:
            address: :8888
            level: detailed

vs

$ ./observe-agent config --render-otel-details | tail -n 40
            receivers:
                - otlp
            processors:
                - resourcedetection
                - resourcedetection/cloud
            exporters:
                - otlphttp/observe
                - count
    telemetry:
        logs:
            encoding: console
            error_output_paths:
                - stderr
            level: info
            output_paths:
                - stderr
            sampling:
                enabled: true
                initial: 10
                thereafter: 100
                tick: 10s
        metrics:
            address: :8888
            level: Detailed
            readers:
                - pull:
                    exporter:
                        prometheus:
                            host: ""
                            port: 8888
                            with_resource_constant_labels: {}
                            without_scope_info: true
                            without_type_suffix: true
                            without_units: true
                        additionalproperties: null
        traces:
            level: Basic
            processors: []
            propagators: []

@obs-gh-alexlew
Copy link
Collaborator

obs-gh-alexlew commented Apr 2, 2025

how is this different from the config command? or you're looking to deprecate that one

@obs-gh-mattcotter
Copy link
Collaborator Author

how is this different from the config command? or you're looking to deprecate that one

Good question! The config command lists out all fragments individually and also dumps the observe-agent config. Really the original mode plus the two others here all serve different purposes. I don't know if we actually want to support three ways of spitting out configs, but the two here are definitely useful and the existing one has been useful in the past. Since it's not much code I'm fine with having all three for now, but let me know if you feel differently.

@obs-gh-mattcotter obs-gh-mattcotter changed the title feat: add config export-otel command to print full otel config feat: add config command flag --render-otel to print full otel config Apr 4, 2025
@obs-gh-mattcotter
Copy link
Collaborator Author

Updated to use flags instead of a new sub command.

colSettings := observecol.GenerateCollectorSettingsWithConfigFiles(configFilePaths)
factories, err := colSettings.Factories()
if err != nil {
return fmt.Errorf("failed to initialize factories: %w", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: are we initializing or just retrieving the existing factories?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, we're initializing the maps. I rephrased this to say: "failed to create component factory maps"

@obs-gh-mattcotter obs-gh-mattcotter merged commit e519ab0 into main Apr 4, 2025
8 checks passed
@obs-gh-mattcotter obs-gh-mattcotter deleted the mc/config-dump branch April 4, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants