microsoft / microsoft/aspire

Add WithMonitoringEndpoint to NatsServerResource

Open
#9,795 0 comments 0 reactions 0 assignees View on GitHub
area-integrations nats
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Background and Motivation

Nats supports a monitoring endpoint when starting with command line argument "-m {port}". Not only can it be used by other dashboards or connected to tracings. It also provides a simplistic UI that provide stats in json format. Additional it also provides an explicit health check route (the current health check periodically propes an connection) which can be used to optionally (?) use it as aspire health check.

Image

Image

Image

I have implementation ready and can send a PR.

## Proposed API
```diff
namespace Aspire.Hosting;

public static class NatsBuilderExtensions
{
+ public static IResourceBuilder WithMonitoringEndpoint(this IResourceBuilder builder, int? port = null, bool addHealthCheckUsingMonitoringEndpoint = true)
}
```

## Usage Examples
```csharp
var nats = builder.AddNats("nats")
.WithMonitoringEndpoint();
```

## Alternative Designs

Don't know of useful alternative forms

## Risks

Note from [monitoring documentation](https://docs.nats.io/running-a-nats-service/nats_admin/monitoring):

> nats-server does not have authentication/authorization for the monitoring endpoint. When you plan to open your nats-server to the internet make sure to not expose the monitoring port as well. By default, monitoring binds to every interface 0.0.0.0 so consider setting monitoring to localhost or have appropriate firewall rules.




Btw. can someone please reopen the PR https://github.com/dotnet/aspire/pull/6056, I don't have permission to do it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.