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

Failover Connector PR2 - core failover functionality #29557

Merged
merged 6 commits into from
Dec 12, 2023

Conversation

akats7
Copy link
Contributor

@akats7 akats7 commented Nov 29, 2023

This is the 2nd PR for the failover connector that implements the core failover functionality. It is currently in place for Traces and once solidified will be repeated for metrics and logs

Link to tracking Issue: #20766

Note: Will add traces tests today but pushing up to begin review

cc: @djaglowski @fatsheep9146

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

A lot of my feedback is surface level style nits as I try to understand the implementation. Some of my questions may have obvious answers but I'm having a very difficult time reasoning about the code because there are perhaps a few too many layers of abstraction for me to wrap my head around immediately.

Comment on lines 67 to 71
if err == nil {
consumers = append(consumers, newConsumer)
} else {
return errConsumer
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: prefer to handle error case and return immediately rather than deeper nesting

Suggested change
if err == nil {
consumers = append(consumers, newConsumer)
} else {
return errConsumer
}
if err != nil {
return errConsumer
}
consumers = append(consumers, newConsumer)


func (f *failoverRouter[C]) registerConsumers() error {
consumers := make([]C, 0)
for _, pipeline := range f.cfg.PipelinePriority {
Copy link
Member

Choose a reason for hiding this comment

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

nit, since we expect potentially multiple pipelines per level

Suggested change
for _, pipeline := range f.cfg.PipelinePriority {
for _, pipelines := range f.cfg.PipelinePriority {

Comment on lines 80 to 85
if f.pS.handleErrorRetryCheck() {
ctx, cancel := context.WithCancel(context.Background())
f.cancelRetry.invokeCancel()
f.cancelRetry.updateCancelFunc(cancel)
f.enableRetry(ctx)
}
Copy link
Member

Choose a reason for hiding this comment

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

nit

Suggested change
if f.pS.handleErrorRetryCheck() {
ctx, cancel := context.WithCancel(context.Background())
f.cancelRetry.invokeCancel()
f.cancelRetry.updateCancelFunc(cancel)
f.enableRetry(ctx)
}
if !f.pS.handleErrorRetryCheck() {
return
}
ctx, cancel := context.WithCancel(context.Background())
f.cancelRetry.invokeCancel()
f.cancelRetry.updateCancelFunc(cancel)
f.enableRetry(ctx)

connector/failoverconnector/failover.go Outdated Show resolved Hide resolved
connector/failoverconnector/failover.go Outdated Show resolved Hide resolved
connector/failoverconnector/failover.go Outdated Show resolved Hide resolved
connector/failoverconnector/failover.go Outdated Show resolved Hide resolved
connector/failoverconnector/failover.go Outdated Show resolved Hide resolved
connector/failoverconnector/traces.go Outdated Show resolved Hide resolved
connector/failoverconnector/failover.go Outdated Show resolved Hide resolved
@akats7
Copy link
Contributor Author

akats7 commented Nov 29, 2023

A lot of my feedback is surface level style nits as I try to understand the implementation. Some of my questions may have obvious answers but I'm having a very difficult time reasoning about the code because there are perhaps a few too many layers of abstraction for me to wrap my head around immediately.

Hey @djaglowski, let me address all your comments and maybe it would be helpful for me to add some more verbose comments in the source

@github-actions github-actions bot added the cmd/otelcontribcol otelcontribcol command label Dec 5, 2023
@akats7
Copy link
Contributor Author

akats7 commented Dec 6, 2023

Hey @djaglowski, I made some updates and added additional comments

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

@akats7, thanks for iterating on this.

The primary consume path seems a lot more clear to me, but I'm still struggling to reconcile the way we are managing indexes.

@akats7
Copy link
Contributor Author

akats7 commented Dec 12, 2023

@djaglowski Can you remove the connector/routing tag, looks like I accidentally modified a file in a commit

@djaglowski djaglowski merged commit 88b3b93 into open-telemetry:main Dec 12, 2023
87 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants