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

#229 Add OpenTelemetry Collector Server Auth Extensions to Receivers #2203

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

aidanleuck
Copy link

@aidanleuck aidanleuck commented Dec 2, 2024

PR Description

Adds server authentication support to otelcol.receivers.* that support the OpenTelemetry collector auth extension model. Some receivers are not wrappers of the collector so they are excluded from this PR.

Receivers that now support server auth:

  • Datadog
  • Jaeger
  • Otlp
  • Opencensus
  • Zipkin
  • Jaeger_Remote_Sampling
  • InfluxDB

Which issue(s) this PR fixes

Fixes #229

Notes to the Reviewer

TestAuthServer in auth_basic_test.go is consistently failing due to a race condition in startup. Any ideas or potential solutions to this problem would be appreciated. The auth_basic plugin appears to function as expected when running from the binary.

User interface for client auth has not changed.

PR Checklist

  • [ x ] CHANGELOG.md updated
  • [ x ] Documentation added
  • [ x ] Tests updated

@aidanleuck aidanleuck requested review from clayton-cornell and a team as code owners December 2, 2024 17:01
@CLAassistant
Copy link

CLAassistant commented Dec 2, 2024

CLA assistant check
All committers have signed the CLA.

@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Dec 9, 2024
@clayton-cornell
Copy link
Contributor

clayton-cornell commented Dec 9, 2024

@grafana/grafana-alloy-maintainers I am going to hold back on reviewing the doc input until after a technical code review has been completed. There are some questions I have about the way things are phrased in the docs that may be resolved with the code review.

@aidanleuck
Copy link
Author

aidanleuck commented Dec 10, 2024

@grafana/grafana-alloy-maintainers I am going to hold back on reviewing the doc input until after a technical code review has been completed. There are some questions I have about the way things are phrased in the docs that may be resolved with the code review.

Thanks for taking a look! Happy to clarify once the code review is complete.

"github.com/grafana/alloy/internal/component/otelcol"
otelcolCfg "github.com/grafana/alloy/internal/component/otelcol/config"
"github.com/grafana/alloy/internal/component/otelcol/receiver"
"github.com/grafana/alloy/internal/featuregate"
Copy link
Author

Choose a reason for hiding this comment

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

It looks like the previous committer used spaces instead of tabs and my code formatted did this. Let me know if you want me to revert this change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Its fine.

@ptodev ptodev self-assigned this Dec 12, 2024
Copy link
Collaborator

@mattdurham mattdurham left a comment

Choose a reason for hiding this comment

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

Overall looks great, much appreciated. Going to run this and make sure I understand it before stamping for approval.

}

// Create an extension id based off the alloy name. For example
// auth.basic.creds will become auth.basic.creds.server/client depending on
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Does this have the slash in the name like the comment describes?

Copy link
Author

Choose a reason for hiding this comment

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

Fixed!

notSupportedErr = ErrNotServerExtension
requiredAuthFeature = ServerAuthSupported
}
if t == Client {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Switch statement might be cleaner here? Or convert to else if? Right now it can only be client or server.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed!

"github.com/grafana/alloy/internal/component/otelcol"
otelcolCfg "github.com/grafana/alloy/internal/component/otelcol/config"
"github.com/grafana/alloy/internal/component/otelcol/receiver"
"github.com/grafana/alloy/internal/featuregate"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Its fine.

@mattdurham
Copy link
Collaborator

Looks like some errors with the auth tests.

@mattdurham mattdurham self-assigned this Dec 12, 2024
@aidanleuck
Copy link
Author

Looks like some errors with the auth tests.

Yeah, I dug into why this test was failing for a couple of hours and my assessment was that it was an issue with the test infrastructure incorrectly reporting that the component is running. See auth_test.go and I have a detailed comment explaining what is happening. Do you have any suggestions or comments on how to wait for the underlying extension to be running on the host?

@mattdurham
Copy link
Collaborator

Will try to take a look at this but for full transparency most of the team is gonna be unavailable for a week or so due to the holidays.

@aidanleuck
Copy link
Author

Will try to take a look at this but for full transparency most of the team is gonna be unavailable for a week or so due to the holidays.

Not a problem, I'm not in any rush to get this PR merged. I did see a PR go through recently that added a /healthy endpoint to a component. I will try using that and let you know. Thanks for the help so far.

@aidanleuck
Copy link
Author

The latest commits should fix the issue with the race condition in auth_basic.go. I have also addressed the outstanding comments on the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Docs Squad label across all Grafana Labs repos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support auth for otelcol.receiver components
5 participants