Repository navigation
feat: add Loki hosting integration - #2247
meysamhadeli wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The gRPC endpoint advertises an unusable TCP URI, and persistence cleanup plus polyglot validation and documentation need correction.
5 open findings
What changed in this PR
Adds a preview Loki hosting integration as a standalone container-backed Aspire service with C#, TypeScript, publishing, persistence, and functional coverage.
Changes:
- Adds Loki resource APIs, endpoints, health checks, connection properties, and mount helpers.
- Adds C# and TypeScript examples plus package documentation.
- Adds app-model, manifest, runtime, persistence, and TypeScript tests.
| File | Description |
|---|---|
README.md |
Adds Loki to the integration catalog. |
CommunityToolkit.Aspire.slnx |
Registers source, test, and example projects. |
src/CommunityToolkit.Aspire.Hosting.Loki/CommunityToolkit.Aspire.Hosting.Loki.csproj |
Defines the preview package. |
src/CommunityToolkit.Aspire.Hosting.Loki/LokiBuilderExtensions.cs |
Implements Loki registration and mount helpers. |
src/CommunityToolkit.Aspire.Hosting.Loki/LokiResource.cs |
Defines endpoints and connection properties. |
src/CommunityToolkit.Aspire.Hosting.Loki/LokiSettings.cs |
Defines configurable container settings. |
src/CommunityToolkit.Aspire.Hosting.Loki/README.md |
Documents basic C# usage. |
tests/CommunityToolkit.Aspire.Hosting.Loki.Tests/CommunityToolkit.Aspire.Hosting.Loki.Tests.csproj |
Defines the test project. |
tests/CommunityToolkit.Aspire.Hosting.Loki.Tests/ResourceCreationTests.cs |
Tests app-model and manifest behavior. |
tests/CommunityToolkit.Aspire.Hosting.Loki.Tests/LokiFunctionalTests.cs |
Tests storage persistence. |
tests/CommunityToolkit.Aspire.Hosting.Loki.Tests/TypeScriptAppHostTests.cs |
Validates TypeScript startup. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost/AppHost.cs |
Demonstrates C# orchestration. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost/CommunityToolkit.Aspire.Hosting.Loki.AppHost.csproj |
Configures the C# AppHost. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost/appsettings.json |
Configures AppHost logging. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost/Properties/launchSettings.json |
Adds AppHost launch profiles. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost.TypeScript/apphost.mts |
Demonstrates TypeScript orchestration. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost.TypeScript/aspire.config.json |
Maps the local integration package. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost.TypeScript/package.json |
Defines TypeScript tooling. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost.TypeScript/package-lock.json |
Locks TypeScript dependencies. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost.TypeScript/tsconfig.json |
Configures TypeScript compilation. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost.TypeScript/eslint.config.mjs |
Configures TypeScript linting. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.Api/Program.cs |
Adds the example API. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.Api/CommunityToolkit.Aspire.Hosting.Loki.Api.csproj |
Configures the API project. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.Api/CommunityToolkit.Aspire.Hosting.Loki.Api.http |
Adds a sample API request. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.Api/appsettings.json |
Configures API logging. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.Api/Properties/launchSettings.json |
Adds the API launch profile. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.ServiceDefaults/Extensions.cs |
Adds shared telemetry and health defaults. |
examples/loki/CommunityToolkit.Aspire.Hosting.Loki.ServiceDefaults/CommunityToolkit.Aspire.Hosting.Loki.ServiceDefaults.csproj |
Defines ServiceDefaults dependencies. |
Files not reviewed (1)
- examples/loki/CommunityToolkit.Aspire.Hosting.Loki.AppHost.TypeScript/package-lock.json: Generated file
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
@dotnet-policy-service agree |
aaronpowell
left a comment
There was a problem hiding this comment.
Couple questions on the csproj
Hi @aaronpowell, Thanks for checking my PR. |
|
All good from me. @afscrome - anything from a rereview? |
Laurianti
left a comment
There was a problem hiding this comment.
I checked these on main (c2b3edb) with this PR (8afbc5f) merged. With all the changes suggested below, the example AppHost builds, a gRPC call to loki.Resource.GrpcEndpoint returns grpc-status: 0, and the 25 Loki tests other than the TypeScript one pass with 3.6.19. I didn't run the TypeScript test.
| "language": "typescript/nodejs" | ||
| }, | ||
| "sdk": { | ||
| "version": "13.6.1" |
There was a problem hiding this comment.
#2338 moved all 57 TypeScript examples to 17.0.0-preview.1.26552.6. This one still has 13.6.1.
| "version": "13.6.1" | |
| "version": "17.0.0-preview.1.26552.6" |
There was a problem hiding this comment.
Thanks for flagging this. I’ll check whether the example works with the updated dependencies on main and align the SDK version if needed.
There was a problem hiding this comment.
On main with this PR, the Loki TypeScript test fails with 13.6.1: aspire restore stops with NU1103, because it can't find Aspire.Hosting and Aspire.Hosting.CodeGeneration.TypeScript 13.6.1. With 17.0.0-preview.1.26552.6, the version the other 56 TypeScript examples use, the test passes. I used Aspire CLI 17.0.0-preview.1.26552.6, the version CI installs, on Windows.
There was a problem hiding this comment.
So it will need to be bumped to the 17.0.0 preview because it won't compile the dependencies for the TypeScript tests.
Just double-check the version before committing, as we're doing nightly updates of the packages to ensure we don't have any gaps on the 17 release.
There was a problem hiding this comment.
@aaronpowell
Thanks for catching that! I’ve bumped the Loki TypeScript AppHost to 17.0.0-preview.1.26552.6 to match the repo’s current dependencies. I’ll push the change to trigger CI again and check whether it fixes the failing test.
There was a problem hiding this comment.
Main has moved to 17.0.0-preview.1.26553.5, which the other 56 TypeScript examples now use. With 26552.6, on main with this PR, the Loki TypeScript test still fails, now with NU1605: CommunityToolkit.Aspire.Hosting.Loki brings Aspire.Hosting 26553.5 and the example asks for 26552.6. With 26553.5 the test passes. I used Aspire CLI 17.0.0-preview.1.26553.5, the version CI installs now, on Windows.
There was a problem hiding this comment.
@Laurianti @aaronpowell
Thanks for catching this and testing it on Windows! I’ve updated Loki to 17.0.0-preview.1.26553.5 to match main and the other TypeScript examples. Appreciate your help tracking down the version mismatch.
There was a problem hiding this comment.
The commit that moves the example to 26553.5 (8b972f6) is on your branch, but the PR hasn't picked it up: its latest commit is still the merge of main (7caa6e3), and CI hasn't run on the new commit. Pushing to the branch again, even an empty commit, usually makes the PR update.
Thanks for testing this and catching both issues! I’ve fixed the gRPC port mismatch and the AppHost build failure. I appreciate the detailed feedback. |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 2247Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 2247" |
| "language": "typescript/nodejs" | ||
| }, | ||
| "sdk": { | ||
| "version": "13.6.1" |
There was a problem hiding this comment.
So it will need to be bumped to the 17.0.0 preview because it won't compile the dependencies for the TypeScript tests.
Just double-check the version before committing, as we're doing nightly updates of the packages to ensure we don't have any gaps on the 17 release.



Overview
Adds a preview
CommunityToolkit.Aspire.Hosting.Lokihosting integration for running Grafana Loki in Aspire.Includes:
Outstanding validation differences:
PR Checklist
Other information
This is a new preview hosting integration. CI test discovery includes
Hosting.Loki.Tests.