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

feat(sinks): enable sinks with token auth. #3061

Merged
merged 8 commits into from
Aug 19, 2024

Conversation

pburrows-ns1
Copy link
Contributor

Enable sinks to be configured with token based authentication.
The required fields for this auth type are:

  1. scheme
  2. token

Rather than scheme being fixed to Bearer, it's customizable because there are many schemes it could be.
For example Dynatrace expect the header to be:
Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890

With the following authentication settings configured on a sink:

{
	"exporter": {
		"endpoint": "https://acme.com/otlphttp/push"
	},
	"authentication": {
		"type": "bearertokenauth",
		"scheme": "Api-Token",
		"token": "abcdefg"
	}
}

The resulting yaml configuration is:

---
receivers:
  kafka:
    brokers:
    - kafka:9092
    topic: otlp_metrics-sink-id-22
    protocol_version: 2.0.0
extensions:
  pprof:
    endpoint: 0.0.0.0:1888
  bearertokenauth/withscheme:
    scheme: Api-Token
    token: abcdefg
exporters:
  otlphttp:
    endpoint: https://acme.com/otlphttp/push
    auth:
      authenticator: bearertokenauth/withscheme
service:
  extensions:
  - pprof
  - bearertokenauth/withscheme
  pipelines:
    metrics:
      receivers:
      - kafka
      exporters:
      - otlphttp

This is in line with what's expected:
https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/4115aad52e0775caed38c3ccc450d8064044efaa/extension/bearertokenauthextension

@mfiedorowicz
Copy link
Member

Hey @pburrows-ns1, thanks for the first-time contribution/pull request 👏🏻 We'll do our best to review it in a timely manner.

Copy link
Member

@mfiedorowicz mfiedorowicz left a comment

Choose a reason for hiding this comment

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

Thanks @pburrows-ns1! Apart from a few minor or code style comments and one clarifying question, it looks like a great contribution 👏🏻

pkg/errors/types.go Outdated Show resolved Hide resolved
pkg/errors/types.go Outdated Show resolved Hide resolved
pkg/errors/types.go Outdated Show resolved Hide resolved
pkg/errors/types.go Outdated Show resolved Hide resolved
pkg/errors/types.go Outdated Show resolved Hide resolved
sinks/authentication_type/basicauth/authentication.go Outdated Show resolved Hide resolved
sinks/authentication_type/basicauth/authentication.go Outdated Show resolved Hide resolved
sinks/authentication_type/basicauth/authentication.go Outdated Show resolved Hide resolved
@mfiedorowicz
Copy link
Member

@pburrows-ns1 could you also merge develop into your branch which has a fix for one of GHA workflows failing here (plus one conflict requiring resolving)? 🙏🏻

pkg/errors/types.go Outdated Show resolved Hide resolved
Copy link
Member

@mfiedorowicz mfiedorowicz left a comment

Choose a reason for hiding this comment

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

Looks good @pburrows-ns1, thanks for contribution!

@mfiedorowicz mfiedorowicz merged commit eca8480 into orb-community:develop Aug 19, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants