https://github.com/kfrancis/k6-aspire-hosting

k6 functionality for .NET Aspire

https://github.com/kfrancis/k6-aspire-hosting

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

k6 functionality for .NET Aspire

Basic Info
  • Host: GitHub
  • Owner: kfrancis
  • License: mit
  • Language: C#
  • Default Branch: main
  • Size: 385 KB
Statistics
  • Stars: 9
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 3
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Funding License

README.md

k6-aspire-hosting

A suite of .NET libraries for integrating Grafana k6 load testing into .NET Aspire applications.

NuGet Build Status License: MIT

Overview

This repository contains a collection of libraries designed to seamlessly integrate Grafana k6 load testing into .NET Aspire applications. It enables developers to define, run, and visualize load tests as part of their Aspire application infrastructure.

Packages

| Package | Description | NuGet | Status | | ------- | ----------- | ----- | ------ | | CSS.K6.Hosting.Core | Core components for k6 integration | NuGet | Functional | | CSS.K6.Hosting.Aspire | Main integration for k6 in Aspire | NuGet | Functional | | CSS.K6.Hosting.Outputs.Grafana | Grafana dashboards for visualizing metrics | NuGet | Functional | | CSS.K6.Hosting.Outputs.InfluxDB | InfluxDB support for storing metrics | NuGet | Functional | | CSS.K6.Hosting.Outputs.Aspire | Aspire support for storing metrics | NuGet | WIP |

Quick Start

1. Install the package

bash dotnet add package CSS.K6.Hosting.Aspire

2. Add k6 to your Aspire application

Create a k6 test script file in your project (e.g., scripts/load-test.js):

```javascript import http from "k6/http"; import { check, sleep } from "k6";

export default function () {

// Get API information from environment
const apiHost = __ENV.APP_HOST;
const apiScheme = __ENV.APP_ENDPOINT_SCHEME;

// Construct the base URL
const baseUrl = `${apiScheme}://${apiHost}`;

console.log(`Testing API at: ${baseUrl}`);

const response = http.get(`${baseUrl}/weatherforecast`);

check(response, {
    'status is 200': (r) => r.status === 200
});

sleep(10);

} ```

Add k6 to your Aspire host application:

```csharp var builder = DistributedApplication.CreateBuilder(args);

// Add your API project var apiProject = builder.AddProject("api");

// Add k6 for load testing builder.AddK6("k6") .WithScript("./scripts/test.js") .WithApiEndpoint(api) .WaitFor(api);

await builder.Build().RunAsync(); ```

Then simply run k6 on the Aspire dashboard:

Current progress

Features

  • Simple Integration: Add k6 load testing to .NET Aspire with minimal configuration
  • API Testing: Automatically test APIs defined in your Aspire application
  • Visualization: Built-in support for Grafana dashboards
  • Metric Storage: Store test results in InfluxDB for analysis
  • Docker-based: Leverages Docker containers for consistent testing environments

Requirements

  • .NET 8.0 or .NET 9.0
  • .NET Aspire
  • Docker (for running containers)

Documentation

For more detailed documentation, see the README files in each package directory:

Examples

See the samples directory for sample applications demonstrating how to use these libraries.

For visualization with Grafana:

bash dotnet add package CSS.K6.Hosting.Outputs.Grafana

For metrics storage with InfluxDB:

bash dotnet add package CSS.K6.Hosting.Outputs.InfluxDB

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

References

License

This project is licensed under the MIT License - see the LICENSE file for details.

Owner

  • Name: Kori Francis
  • Login: kfrancis
  • Kind: user
  • Location: Kingston, Ontario
  • Company: Clinical Support Systems

CTO of Clinical Support Systems, father and musician. Message me @kori@c.im npub1rtf5az4zvh04h4ssddzntf4gy55pg8hasq97kddkgy7h4q5cws0sv9fttd

GitHub Events

Total
  • Create event: 7
  • Issues event: 1
  • Release event: 3
  • Watch event: 6
  • Issue comment event: 1
  • Member event: 1
  • Push event: 21
  • Fork event: 1
Last Year
  • Create event: 7
  • Issues event: 1
  • Release event: 3
  • Watch event: 6
  • Issue comment event: 1
  • Member event: 1
  • Push event: 21
  • Fork event: 1

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 22
  • Total Committers: 2
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.045
Past Year
  • Commits: 22
  • Committers: 2
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.045
Top Committers
Name Email Commits
Kori Francis k****s@c****m 21
Tomonobu Fukuhara f****r@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • anddrzejb (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 4
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 8
nuget.org: css.k6.hosting.outputs.influxdb

InfluxDB output provider for storing and querying k6 load test metrics in .NET Aspire applications.

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 7.0%
Average: 12.8%
Dependent packages count: 18.7%
Last synced: 10 months ago
nuget.org: css.k6.hosting.outputs.grafana

Grafana dashboard integration for visualizing k6 load test results in .NET Aspire applications.

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 7.0%
Average: 12.8%
Dependent packages count: 18.7%
Last synced: 10 months ago
nuget.org: css.k6.hosting.aspire

Integration for running Grafana k6 load tests within .NET Aspire applications.

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 7.0%
Average: 12.8%
Dependent packages count: 18.7%
Last synced: 10 months ago
nuget.org: css.k6.hosting.core

Core components for integrating Grafana k6 load testing into .NET Aspire applications.

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 7.0%
Average: 12.8%
Dependent packages count: 18.7%
Last synced: 11 months ago

Dependencies

.github/workflows/publish.yml actions
  • actions/checkout v4.2.2 composite
  • actions/download-artifact v4.1.8 composite
  • actions/setup-dotnet v4.2.0 composite
  • actions/upload-artifact v4.6.0 composite
samples/BasicK6Sample/BasicK6Sample.ApiService/BasicK6Sample.ApiService.csproj nuget
samples/BasicK6Sample/BasicK6Sample.AppHost/BasicK6Sample.AppHost.csproj nuget
  • Aspire.Hosting.AppHost 9.1.0
samples/BasicK6Sample/BasicK6Sample.ServiceDefaults/BasicK6Sample.ServiceDefaults.csproj nuget
  • Microsoft.Extensions.Http.Resilience 9.2.0
  • Microsoft.Extensions.ServiceDiscovery 9.1.0
  • OpenTelemetry.Exporter.OpenTelemetryProtocol 1.11.1
  • OpenTelemetry.Extensions.Hosting 1.11.1
  • OpenTelemetry.Instrumentation.AspNetCore 1.11.0
  • OpenTelemetry.Instrumentation.Http 1.11.0
  • OpenTelemetry.Instrumentation.Runtime 1.11.0
samples/GrafanaInfluxDbSample/GrafanaInfluxDbSample.ApiService/GrafanaInfluxDbSample.ApiService.csproj nuget
samples/GrafanaInfluxDbSample/GrafanaInfluxDbSample.AppHost/GrafanaInfluxDbSample.AppHost.csproj nuget
  • Aspire.Hosting.AppHost 9.1.0
samples/GrafanaInfluxDbSample/GrafanaInfluxDbSample.ServiceDefaults/GrafanaInfluxDbSample.ServiceDefaults.csproj nuget
  • Microsoft.Extensions.Http.Resilience 9.2.0
  • Microsoft.Extensions.ServiceDiscovery 9.1.0
  • OpenTelemetry.Exporter.OpenTelemetryProtocol 1.11.1
  • OpenTelemetry.Extensions.Hosting 1.11.1
  • OpenTelemetry.Instrumentation.AspNetCore 1.11.0
  • OpenTelemetry.Instrumentation.Http 1.11.0
  • OpenTelemetry.Instrumentation.Runtime 1.11.0
src/K6.Hosting.Aspire/K6.Hosting.Aspire.csproj nuget
  • DotNet.ReproducibleBuilds 1.2.25 development
  • MinVer 6.0.0 development
src/K6.Hosting.Core/K6.Hosting.Core.csproj nuget
  • DotNet.ReproducibleBuilds 1.2.25 development
  • MinVer 6.0.0 development
  • Aspire.Hosting 9.1.0
src/K6.Hosting.Outputs.Grafana/K6.Hosting.Outputs.Grafana.csproj nuget
  • DotNet.ReproducibleBuilds 1.2.25 development
  • MinVer 6.0.0 development
src/K6.Hosting.Outputs.InfluxDB/K6.Hosting.Outputs.InfluxDB.csproj nuget
  • DotNet.ReproducibleBuilds 1.2.25 development
  • MinVer 6.0.0 development
src/K6.Hosting.Outputs.Aspire/K6.Hosting.Outputs.Aspire.csproj nuget
  • OpenTelemetry.Exporter.OpenTelemetryProtocol 1.11.2
src/K6.Hosting.Outputs.Prometheus/K6.Hosting.Outputs.Prometheus.csproj nuget