Skip to content

Conversation

@Odonno
Copy link
Contributor

@Odonno Odonno commented Mar 25, 2025

Description

Grafana k6 requires env variable with a K6_ prefix. This change allow developers to add a prefix for every OTEL env variables.

See the list of env variables that can be set for a k6 instance: https://grafana.com/docs/k6/latest/results-output/real-time/opentelemetry/#configuration

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 25, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 25, 2025
@mitchdenny
Copy link
Member

This reads to me like K6 can read the ones we emit:

image

@mitchdenny
Copy link
Member

TBH this seems like something that needs to be fixed on the K6 side. If you wanted to work around an issue with any of the variables that they provide you could look at doing this:

builder.AddProject<Projects.HelloAspire_Web>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithReference(apiService)
    .WaitFor(apiService)
    .WithEnvironment(context => {
        context.EnvironmentVariables["K6_OTEL_SERVICE_NAME"] = context.EnvironmentVariables["OTEL_SERVICE_NAME"];
    });

@Odonno
Copy link
Contributor Author

Odonno commented Mar 26, 2025

This reads to me like K6 can read the ones we emit:

image

That may be possible. Either way, I am not able to make it work with Podman due to some network issues. I'll assume it should work then.

@Odonno
Copy link
Contributor Author

Odonno commented Mar 26, 2025

TBH this seems like something that needs to be fixed on the K6 side. If you wanted to work around an issue with any of the variables that they provide you could look at doing this:

builder.AddProject<Projects.HelloAspire_Web>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithReference(apiService)
    .WaitFor(apiService)
    .WithEnvironment(context => {
        context.EnvironmentVariables["K6_OTEL_SERVICE_NAME"] = context.EnvironmentVariables["OTEL_SERVICE_NAME"];
    });

Clever solution. Thank you.

@Odonno Odonno closed this Mar 26, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants