Skip to content

Support configuration of basic auth for OTLP HTTP exporter. - #5997

Merged
oleiade merged 1 commit into
grafana:masterfrom
jeschkies:karsten/otlp-auth
Jun 16, 2026
Merged

Support configuration of basic auth for OTLP HTTP exporter.#5997
oleiade merged 1 commit into
grafana:masterfrom
jeschkies:karsten/otlp-auth

Conversation

@jeschkies

Copy link
Copy Markdown
Contributor

What?

This change adds the option to define K6_OTEL_HTTP_EXPORTER_USERNAME and K6_OTEL_HTTP_EXPORTER_PASSWORD to set baisc auth credentials directly.

Why?

While it is possible to define an Authorization header via K6_OTEL_HEADERS it is a bit inconvenient when used through Kubernetes secrets. Eg a secret would have to include the value Authorization= Basic <base64(user+":"password)>. It is simpler to pass username and password.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

@jeschkies
jeschkies requested a review from a team as a code owner May 15, 2026 11:00
@jeschkies
jeschkies requested review from mstoykov and oleiade and removed request for a team May 15, 2026 11:00
@cla-assistant

cla-assistant Bot commented May 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented May 15, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jeschkies
jeschkies temporarily deployed to azure-trusted-signing May 15, 2026 11:06 — with GitHub Actions Inactive
@jeschkies
jeschkies temporarily deployed to azure-trusted-signing May 15, 2026 11:07 — with GitHub Actions Inactive
@mstoykov mstoykov added this to the v2.1.0 milestone May 15, 2026

@mstoykov mstoykov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, left a small nit comment on UX

if cfg.HTTPUsername.Valid {
auth := []byte(cfg.HTTPUsername.String + ":" + cfg.HTTPPassword.String)
headers["Authorization"] = fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString(auth))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this require password as well and error if only one present. I guess this might need to happen earlier in the confiugraiton?

@oleiade
oleiade merged commit b61f612 into grafana:master Jun 16, 2026
51 checks passed
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