Skip to content

Config to String does not properly convert the tlsConfig min_version #11417

@tliefheid

Description

@tliefheid

What did you do?

context:
we do some validations on incoming prometheus config, and then write it to a file for prometheus to pick up.
In our internal code we use config.Load this nicely imports the users config and verifies it. Later on we use cfg.String() to write it to a file.

When using the .String() method on the config, it will convert the HTTPClientConfig.TLSConfig.MinVersion on load nicely from a String to a TlsVersion. but after calling .String() it will save a number (like 772) instead of the original string value from the user. This is currently breaking our logic.

The question is: Is the .String() method failing to map back the value, or is this expected behaviour

What did you expect to see?

given:

  tls_config:
    min_version: "TLS12"

i want

  tls_config:
    min_version: "TLS12"

after calling .String()

What did you see instead? Under which circumstances?

  tls_config:
    insecure_skip_verify: false
    min_version: 771

System information

Darwin 21.6.0 arm64

Prometheus version

github.com/prometheus/common v0.37.0
github.com/prometheus/prometheus v0.38.0

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions