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

Use Endpoint for health check extention #2782

Merged
merged 9 commits into from
Mar 26, 2021

Conversation

dstdfx
Copy link
Contributor

@dstdfx dstdfx commented Mar 24, 2021

Description:
Change health check extension's config to use Endpoint instead of Port, fix tests according to the changes.

Link to tracking Issue: #2764

@dstdfx dstdfx requested a review from a team March 24, 2021 08:27
// Port is the port used to publish the health check status.
// The default value is 13133.
Port uint16 `mapstructure:"port"`
// Endpoint is the address and port used to publish the health check status.
Copy link
Member

Choose a reason for hiding this comment

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

Can we do this change in two stages? Add the new one and deprecate the old option in one step, remove the deprecated in the next step. This is the type of change that doesn't need to be breaking for current users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I'll bring it back next commit

@codecov
Copy link

codecov bot commented Mar 24, 2021

Codecov Report

Merging #2782 (a186856) into main (525e2cf) will decrease coverage by 0.02%.
The diff coverage is 61.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2782      +/-   ##
==========================================
- Coverage   91.64%   91.62%   -0.03%     
==========================================
  Files         294      294              
  Lines       15637    15647      +10     
==========================================
+ Hits        14331    14336       +5     
- Misses        896      899       +3     
- Partials      410      412       +2     
Impacted Files Coverage Δ
...nsion/healthcheckextension/healthcheckextension.go 80.00% <50.00%> (-12.60%) ⬇️
extension/healthcheckextension/factory.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 525e2cf...a186856. Read the comment docs.

@dstdfx
Copy link
Contributor Author

dstdfx commented Mar 24, 2021

@jpkrohling
Copy link
Member

Not sure, I just restarted the build.


// Endpoint is the address and port used to publish the health check status.
// The default value is "localhost:13133".
Endpoint string `mapstructure:"endpoint"`
Copy link
Member

Choose a reason for hiding this comment

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

Use confignet:

TcpAddr confignet.TcpAddr `mapstructure:",squash"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, I'd also suggest using confignet.TCPAddr instead of string in other extensions for the sake of consistency e.x:
https://github.com/open-telemetry/opentelemetry-collector/blob/main/extension/pprofextension/config.go#L29

I can fix it next PR.

@bogdandrutu
Copy link
Member

Please rebase

@dstdfx dstdfx force-pushed the use-endpoint-hc-ext branch from 6ef287f to 8e77382 Compare March 25, 2021 15:09
@@ -41,8 +39,7 @@ func (hc *healthCheckExtension) Start(_ context.Context, host component.Host) er
hc.logger.Info("Starting health_check extension", zap.Any("config", hc.config))

// Initialize listener
portStr := ":" + strconv.Itoa(int(hc.config.Port))
ln, err := net.Listen("tcp", portStr)
ln, err := hc.config.TCPAddr.Listen()
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to do some backwards compatible things here correct?

if port != 0 and endpoint == default then endpoint = ":" + port

ln net.Listener
err error
)
if hc.config.Port != 0 && hc.config.TCPAddr.Endpoint == defaultEndpoint {
Copy link
Member

Choose a reason for hiding this comment

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

Also log a deprecation warning for users to change to endpoint :)

@bogdandrutu
Copy link
Member

@dstdfx last request :))) can you please add a changelog entry for this?

@dstdfx dstdfx force-pushed the use-endpoint-hc-ext branch from d341c69 to 6019f8a Compare March 25, 2021 19:58
@bogdandrutu
Copy link
Member

Some fmt issues with imports:

make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
extension/healthcheckextension/config_test.go: Expected no more than 3 groups, got 4
extension/healthcheckextension/factory_test.go: Expected no more than 3 groups, got 4
extension/healthcheckextension/healthcheckextension_test.go: Expected no more than 3 groups, got 4

Signed-off-by: Daniil Rutskiy <[email protected]>
@dstdfx
Copy link
Contributor Author

dstdfx commented Mar 26, 2021

@bogdandrutu bogdandrutu merged commit 1479745 into open-telemetry:main Mar 26, 2021
dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Mar 26, 2021
This commits brings back default configuration of the health_check extension to make sure it works in k8s-like environments without extra configuration as it was before the latest change open-telemetry#2782.

Resolves: open-telemetry#2827
@dstdfx dstdfx deleted the use-endpoint-hc-ext branch March 27, 2021 17:43
dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Mar 27, 2021
This commits brings back default configuration of the health_check extension to make sure it works in k8s-like environments without extra configuration as it was before the latest change open-telemetry#2782.

Resolves: open-telemetry#2827
bogdandrutu pushed a commit that referenced this pull request Mar 28, 2021
This commits brings back default configuration of the health_check extension to make sure it works in k8s-like environments without extra configuration as it was before the latest change #2782.

Resolves: #2827
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.

3 participants