-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Create a new AWS ECS Health Check Extension #4451
Conversation
Hi @bogdandrutu ! could you help review this pr? thanks! |
@Aneurysm9 can you please help to review this one from AWS side? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a README explaining the config and rotation mechanism.
Please rebase :) |
# Conflicts: # go.mod # internal/components/components.go
Hey @bogdandrutu ! please have a review again, and point out if any changes needed. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
# Conflicts: # extension/awsecshealthcheckextension/go.mod # extension/awsecshealthcheckextension/go.sum # internal/components/components.go
This should not be marked as stale, we still want it released. |
There doesn't seem to be anything ECS-specific in this code. Shouldn't the ability to become not-ready when there are an excessive number of exporter failures be added to the normal Related is there is interest in rewriting that extension to use a system such as https://github.com/alexliesenfeld/health @jpkrohling @bogdandrutu |
Yes, I would prefer to have this in place of the current health check extension. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
|
||
func TestLoadConfig(t *testing.T) { | ||
factories, err := componenttest.NopFactories() | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.NoError(t, err) | |
require.NoError(t, err) |
If this fails, it would create a flaky test with a nil pointer exception
|
||
// ECSHealthCheckExporter is a struct implement the exporter interface in open census that could export metrics | ||
type ecsHealthCheckExporter struct { | ||
mu sync.Mutex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mu sync.Mutex | |
rw sync.RWMutex |
Using a RW Mutex will allow better performance.
|
||
viewNum := len(e.exporterErrorQueue) | ||
currentTime := time.Now() | ||
for i := 0; i < viewNum; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it is managing a sliding window so index values could be stored inside the struct, improving performance.
"testing" | ||
"time" | ||
|
||
"gotest.tools/v3/assert" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could i ask you https://pkg.go.dev/github.com/stretchr/testify/assert instead? It heavily used within the project and keeps testing patterns the same.
) | ||
|
||
func TestECSHealthCheckExporter_ExportView(t *testing.T) { | ||
exporter := &ecsHealthCheckExporter{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could I ask you to us t.Parallel()
in tests?
Would allow to speed up testing throughout the project 🙏🏽
default: | ||
} | ||
|
||
if err := hc.server.Serve(ln); err != http.ErrServerClosed && err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use errors.Is
?
"github.com/stretchr/testify/require" | ||
"go.uber.org/zap" | ||
|
||
"go.opencensus.io/stats/view" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correctly "import-ed" ?
ExporterErrorLimit: 1, | ||
} | ||
|
||
hcExt := newServer(config, zap.NewNop()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hcExt := newServer(config, zap.NewNop()) | |
hcExt := newServer(config, zaptest.NewTestLogger(t)) |
} | ||
|
||
func TestHealthCheckExtensionPortAlreadyInUse(t *testing.T) { | ||
endpoint := "localhost:13134" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has potential to cause bind issues since it matches above, would be better to use httptest.NewServer
?
Interval: "5m", | ||
ExporterErrorLimit: 5, | ||
} | ||
hcExt := newServer(config, zap.NewNop()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hcExt := newServer(config, zap.NewNop()) | |
hcExt := newServer(config, zaptest.NewTestLogger(t)) |
Can you resolve the conflicts please? |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Comments from @MovieStoreGuy require reassessment.
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
* `configgrpc`: Update `ToDialOptions` with settings Adding the ability to pass TelemetrySettings to ToDialOptions to configure underlying instrumentation library. Fixes open-telemetry#4424 * update changelog * add telemetrysetting to exporter
Description:
This is a new health check extension feature for AWS/ECS, as we are going to monitor the OT collector health through the return status from endpoint of the new extension, detailed design in the design doc below.
Link to tracking Issue:
open-telemetry/opentelemetry-collector#2573
Testing:
make otelcontribcol
and run executable fileDocumentation:
https://docs.google.com/document/d/1SpUMsWA2DeaoVazeQ8uEc1Wvu5LphmQU_TjzLmuJ4QM/edit#heading=h.rs1luwizct2w
original pr which has some discussion with @bogdandrutu and code is almost same as this pr:
open-telemetry/opentelemetry-collector#3614