Skip to content
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

modify simpleprometheus receiver to use httpclientsetting #11553

Conversation

fatsheep9146
Copy link
Contributor

Signed-off-by: Ziqi Zhao [email protected]

Description:
Fix #9571

Link to tracking Issue:
#9571

@fatsheep9146
Copy link
Contributor Author

ping @codeboten @dmitryax , I already modify the simpleprometheusreceiver to use confighttp.HttpClientSetting, but there is still one problem that I'm not sure, since the origin tls config of simpleprometheusreceiver has totally different key name from the tls config of confighttp.HttpClientSetting.

for example, the tls config of simpleprometheusreceiver is

        endpoint: "172.17.0.5:9153"
        tls_enabled: true
        tls_config:
            ca_file: "/path/to/ca"
            cert_file: "/path/to/cert"
            key_file: "/path/to/key"
            insecure_skip_verify: true

the tls config of confighttp.HttpClientSetting is

    endpoint: myserver.local:55690
    tls:
      insecure: false
      ca_file: server.crt
      cert_file: client.crt
      key_file: client.key

What is the best way to release those changes safely? Does this have any guideline like https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#breaking-changes?

@dmitryax
Copy link
Member

Please keep support of tls_config as a deprecated option for now and show a warning log if it's being used. It can be removed later

@fatsheep9146 fatsheep9146 force-pushed the simpleprometheus-use-httpclientsetting branch from 6fa8dbc to ac1fe8b Compare June 29, 2022 05:18
@fatsheep9146
Copy link
Contributor Author

fatsheep9146 commented Jun 29, 2022

Please keep support of tls_config as a deprecated option for now and show a warning log if it's being used. It can be removed later
@dmitryax

I add tls_config , tls_enable back to configuration, add a new function getPrometheusConfigWrapper in the basic of getPrometheusConfig.

If user specify tls_enable , I print a warning log and use the info in tls_config to create httpClientSetting config then pass to getPrometheusConfig.

In this way, I think we can just delete tls_enable, tls_config field, function getPrometheusConfigWrapper and use getPrometheusConfig directly.

Signed-off-by: Ziqi Zhao <[email protected]>
@dmitryax
Copy link
Member

Please add a changelog entry

Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

One nit, otherwise LGTM

receiver/simpleprometheusreceiver/receiver.go Outdated Show resolved Hide resolved
Signed-off-by: Ziqi Zhao <[email protected]>
Signed-off-by: Ziqi Zhao <[email protected]>
@fatsheep9146 fatsheep9146 force-pushed the simpleprometheus-use-httpclientsetting branch from 0c7ef8f to 720ee27 Compare June 30, 2022 00:16
Signed-off-by: Ziqi Zhao <[email protected]>
Signed-off-by: Ziqi Zhao <[email protected]>
@fatsheep9146
Copy link
Contributor Author

ping @codeboten @dmitryax I think pr is ready to merge :-)

Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

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

Did you test the receiver? I doesn't look like working for regular http endpoints

receiver/simpleprometheusreceiver/receiver.go Show resolved Hide resolved
Signed-off-by: Ziqi Zhao <[email protected]>
Signed-off-by: Ziqi Zhao <[email protected]>
@dmitryax dmitryax merged commit 6b72286 into open-telemetry:main Jul 1, 2022
atoulme pushed a commit to atoulme/opentelemetry-collector-contrib that referenced this pull request Jul 16, 2022
…etry#11553)

* modify simpleprometheus receiver to use httpclientsetting

Signed-off-by: Ziqi Zhao <[email protected]>

* add back old setting

Signed-off-by: Ziqi Zhao <[email protected]>

* fix readme

Signed-off-by: Ziqi Zhao <[email protected]>

* fix reviews

Signed-off-by: Ziqi Zhao <[email protected]>

* add changelog

Signed-off-by: Ziqi Zhao <[email protected]>

* fix for lints

Signed-off-by: Ziqi Zhao <[email protected]>

* fix for deadlink

Signed-off-by: Ziqi Zhao <[email protected]>

* fix default config and add more test

Signed-off-by: Ziqi Zhao <[email protected]>

* fix bugs

Signed-off-by: Ziqi Zhao <[email protected]>

* fix for lint

Signed-off-by: Ziqi Zhao <[email protected]>
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.

Simple Prometheus receiver should use HTTP Client Settings
3 participants