Skip to content

Wire k6provider structured logging into k6 - #5845

Merged
mstoykov merged 3 commits into
grafana:masterfrom
mstoykov:k6providerLogging
Apr 29, 2026
Merged

Wire k6provider structured logging into k6#5845
mstoykov merged 3 commits into
grafana:masterfrom
mstoykov:k6providerLogging

Conversation

@mstoykov

@mstoykov mstoykov commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

What?

Adds a slog.Handler bridge (logrusSlogHandler) that forwards k6provider's
structured log events through k6's existing logrus logger. Provider operations
— artifact resolution, cache hits, downloads, retries, and cache pruning —
now appear in k6's log output at the correct level with structured fields.

Removes the now-redundant manual "A new k6 binary has been provisioned"
Info log and its formatDependencies helper from the provisioner.

Screenshots and log output examples: grafana/k6provider#116

Why?

k6provider gained structured slog logging support (grafana/k6provider#116).
Without this change those log events are silently discarded. Wiring them
through k6's logger makes provisioning behaviour observable without adding
noise for users who don't need it (Debug-level events stay hidden by default).

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.

Related PR(s)/Issue(s)

Note: k6provider is currently pinned to a pre-release pseudo-version
while grafana/k6provider#116 is in review. The dependency will be updated
to the tagged release before this PR is merged.

@mstoykov
mstoykov requested a review from a team as a code owner April 15, 2026 10:11
@mstoykov
mstoykov requested review from codebien and oleiade and removed request for a team April 15, 2026 10:11
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing April 15, 2026 10:17 — with GitHub Actions Inactive
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing April 15, 2026 10:19 — with GitHub Actions Inactive
@mstoykov
mstoykov force-pushed the k6providerLogging branch from 9fb6f00 to f7a30b9 Compare April 16, 2026 08:32
@mstoykov mstoykov mentioned this pull request Apr 16, 2026
4 tasks
@mstoykov
mstoykov force-pushed the k6providerLogging branch from f7a30b9 to 2f8b4ab Compare April 16, 2026 09:04
@mstoykov mstoykov added this to the v2.0.0 milestone Apr 16, 2026
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing April 16, 2026 09:10 — with GitHub Actions Inactive
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing April 16, 2026 09:12 — with GitHub Actions Inactive
oleiade
oleiade previously approved these changes Apr 27, 2026
Comment thread internal/cmd/logrus_slog.go Outdated

@codebien codebien 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, @mstoykov can you rebase plaese?

mstoykov and others added 2 commits April 27, 2026 12:29
Adds a slog.Handler bridge (logrusSlogHandler) that forwards k6provider's
structured log events through k6's existing logrus logger, so provider
operations (artifact resolution, cache hits, downloads, retries, pruning)
appear in k6's log output at the correct level.

Removes the now-redundant manual provisioning Info log and its
formatDependencies helper from k6buildProvisioner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Théo Crevon <oleiade@users.noreply.github.com>
@mstoykov
mstoykov force-pushed the k6providerLogging branch from 0c44054 to b99bb0c Compare April 27, 2026 09:30
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing April 27, 2026 09:35 — with GitHub Actions Inactive
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing April 27, 2026 09:38 — with GitHub Actions Inactive
@mstoykov
mstoykov requested review from codebien and oleiade April 28, 2026 09:44
codebien
codebien previously approved these changes Apr 28, 2026
@mstoykov
mstoykov merged commit fb30dcf into grafana:master Apr 29, 2026
52 checks passed
@mstoykov
mstoykov deleted the k6providerLogging branch April 29, 2026 07:08
mstoykov added a commit that referenced this pull request May 15, 2026
Adds a slog.Handler bridge (logrusSlogHandler) that forwards k6provider's
structured log events through k6's existing logrus logger, so provider
operations (artifact resolution, cache hits, downloads, retries, pruning)
appear in k6's log output at the correct level.

Removes the now-redundant manual provisioning Info log from
k6buildProvisioner.provision.

Backport of #5845.
mstoykov added a commit that referenced this pull request May 18, 2026
Adds a slog.Handler bridge (logrusSlogHandler) that forwards k6provider's
structured log events through k6's existing logrus logger, so provider
operations (artifact resolution, cache hits, downloads, retries, pruning)
appear in k6's log output at the correct level.

Removes the now-redundant manual provisioning Info log from
k6buildProvisioner.provision.

Backport of #5845.
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.

4 participants