Tag all Valkey/Redis connections with service-specific ClientName
Set ClientName on every Redis/Valkey connection across Scanner, Signals, Concelier, Notify, Scheduler, Timeline, and Router for easier connection attribution in monitoring. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -91,6 +91,7 @@ public sealed class ConcelierCacheConnectionFactory : IAsyncDisposable
|
|||||||
config.AsyncTimeout = (int)_options.AsyncTimeout.TotalMilliseconds;
|
config.AsyncTimeout = (int)_options.AsyncTimeout.TotalMilliseconds;
|
||||||
config.ConnectRetry = _options.ConnectRetry;
|
config.ConnectRetry = _options.ConnectRetry;
|
||||||
config.DefaultDatabase = _options.Database;
|
config.DefaultDatabase = _options.Database;
|
||||||
|
config.ClientName ??= "stellaops-concelier-cache";
|
||||||
|
|
||||||
_logger?.LogDebug("Connecting to Valkey at {Endpoint} (database {Database})",
|
_logger?.LogDebug("Connecting to Valkey at {Endpoint} (database {Database})",
|
||||||
_options.ConnectionString, _options.Database);
|
_options.ConnectionString, _options.Database);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named Concelier advisory-cache Valkey client construction. |
|
||||||
| AUDIT-0145-M | DONE | Revalidated 2026-01-06. |
|
| AUDIT-0145-M | DONE | Revalidated 2026-01-06. |
|
||||||
| AUDIT-0145-T | DONE | Revalidated 2026-01-06. |
|
| AUDIT-0145-T | DONE | Revalidated 2026-01-06. |
|
||||||
| AUDIT-0145-A | TODO | Revalidated 2026-01-06 (open findings: warmup determinism, invariant parsing, missing tests). |
|
| AUDIT-0145-A | TODO | Revalidated 2026-01-06 (open findings: warmup determinism, invariant parsing, missing tests). |
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ internal sealed class RedisConnectionFactory : IRedisConnectionFactory
|
|||||||
public async Task<IConnectionMultiplexer> ConnectAsync(ConfigurationOptions options, CancellationToken cancellationToken)
|
public async Task<IConnectionMultiplexer> ConnectAsync(ConfigurationOptions options, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(options);
|
ArgumentNullException.ThrowIfNull(options);
|
||||||
|
options.ClientName ??= "stellaops-scheduler-graph-events";
|
||||||
|
|
||||||
var completionSource = new TaskCompletionSource<IConnectionMultiplexer>(TaskCreationOptions.RunContinuationsAsynchronously);
|
var completionSource = new TaskCompletionSource<IConnectionMultiplexer>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||||
cancellationToken.Register(() => completionSource.TrySetCanceled(cancellationToken));
|
cancellationToken.Register(() => completionSource.TrySetCanceled(cancellationToken));
|
||||||
|
|||||||
@@ -497,6 +497,7 @@ internal abstract class RedisSchedulerQueueBase<TMessage> : ISchedulerQueue<TMes
|
|||||||
config.AbortOnConnectFail = false;
|
config.AbortOnConnectFail = false;
|
||||||
config.ConnectTimeout = (int)_redisOptions.InitializationTimeout.TotalMilliseconds;
|
config.ConnectTimeout = (int)_redisOptions.InitializationTimeout.TotalMilliseconds;
|
||||||
config.ConnectRetry = 3;
|
config.ConnectRetry = 3;
|
||||||
|
config.ClientName ??= "stellaops-scheduler-queue";
|
||||||
|
|
||||||
if (_redisOptions.Database is not null)
|
if (_redisOptions.Database is not null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_sol
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named scheduler queue Valkey client construction. |
|
||||||
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Scheduler/__Libraries/StellaOps.Scheduler.Queue/StellaOps.Scheduler.Queue.md. |
|
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Scheduler/__Libraries/StellaOps.Scheduler.Queue/StellaOps.Scheduler.Queue.md. |
|
||||||
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
||||||
|
|||||||
@@ -439,6 +439,7 @@ internal sealed class RedisNotifyDeliveryQueue : INotifyDeliveryQueue, IAsyncDis
|
|||||||
|
|
||||||
var configuration = ConfigurationOptions.Parse(_redisOptions.ConnectionString!);
|
var configuration = ConfigurationOptions.Parse(_redisOptions.ConnectionString!);
|
||||||
configuration.AbortOnConnectFail = false;
|
configuration.AbortOnConnectFail = false;
|
||||||
|
configuration.ClientName ??= "stellaops-notify-delivery-queue";
|
||||||
if (_redisOptions.Database.HasValue)
|
if (_redisOptions.Database.HasValue)
|
||||||
{
|
{
|
||||||
configuration.DefaultDatabase = _redisOptions.Database.Value;
|
configuration.DefaultDatabase = _redisOptions.Database.Value;
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ internal sealed class RedisNotifyEventQueue : INotifyEventQueue, IAsyncDisposabl
|
|||||||
|
|
||||||
var configuration = ConfigurationOptions.Parse(_redisOptions.ConnectionString!);
|
var configuration = ConfigurationOptions.Parse(_redisOptions.ConnectionString!);
|
||||||
configuration.AbortOnConnectFail = false;
|
configuration.AbortOnConnectFail = false;
|
||||||
|
configuration.ClientName ??= "stellaops-notify-event-queue";
|
||||||
if (_redisOptions.Database.HasValue)
|
if (_redisOptions.Database.HasValue)
|
||||||
{
|
{
|
||||||
configuration.DefaultDatabase = _redisOptions.Database;
|
configuration.DefaultDatabase = _redisOptions.Database;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named Notify event and delivery queue Valkey client construction. |
|
||||||
| AUDIT-0413-M | DONE | Revalidated 2026-01-07; maintainability audit for StellaOps.Notify.Queue. |
|
| AUDIT-0413-M | DONE | Revalidated 2026-01-07; maintainability audit for StellaOps.Notify.Queue. |
|
||||||
| AUDIT-0413-T | DONE | Revalidated 2026-01-07; test coverage audit for StellaOps.Notify.Queue. |
|
| AUDIT-0413-T | DONE | Revalidated 2026-01-07; test coverage audit for StellaOps.Notify.Queue. |
|
||||||
| AUDIT-0413-A | TODO | Revalidated 2026-01-07 (open findings). |
|
| AUDIT-0413-A | TODO | Revalidated 2026-01-07 (open findings). |
|
||||||
|
|||||||
@@ -21,7 +21,12 @@ public sealed class PostgresConnectionFactory : IAsyncDisposable
|
|||||||
_options = options.Value;
|
_options = options.Value;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
var builder = new NpgsqlDataSourceBuilder(_options.ConnectionString);
|
var connectionStringBuilder = new NpgsqlConnectionStringBuilder(_options.ConnectionString)
|
||||||
|
{
|
||||||
|
ApplicationName = "stellaops-router-postgres-transport",
|
||||||
|
};
|
||||||
|
|
||||||
|
var builder = new NpgsqlDataSourceBuilder(connectionStringBuilder.ConnectionString);
|
||||||
_dataSource = builder.Build();
|
_dataSource = builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: added stable PostgreSQL application-name attribution to the router Postgres transport factory. |
|
||||||
| AUDIT-0382-M | DONE | Revalidated 2026-01-07; maintainability audit for Postgres transport. |
|
| AUDIT-0382-M | DONE | Revalidated 2026-01-07; maintainability audit for Postgres transport. |
|
||||||
| AUDIT-0382-T | DONE | Revalidated 2026-01-07; test coverage audit for Postgres transport. |
|
| AUDIT-0382-T | DONE | Revalidated 2026-01-07; test coverage audit for Postgres transport. |
|
||||||
| AUDIT-0382-A | TODO | Revalidated 2026-01-07 (open findings). |
|
| AUDIT-0382-A | TODO | Revalidated 2026-01-07 (open findings). |
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named Valkey transport multiplexer construction and added runtime guardrail coverage. |
|
||||||
| AUDIT-0383-M | DONE | Revalidated 2026-01-07; maintainability audit for Valkey transport. |
|
| AUDIT-0383-M | DONE | Revalidated 2026-01-07; maintainability audit for Valkey transport. |
|
||||||
| AUDIT-0383-T | DONE | Revalidated 2026-01-07; test coverage audit for Valkey transport. |
|
| AUDIT-0383-T | DONE | Revalidated 2026-01-07; test coverage audit for Valkey transport. |
|
||||||
| AUDIT-0383-A | TODO | Revalidated 2026-01-07 (open findings). |
|
| AUDIT-0383-A | TODO | Revalidated 2026-01-07 (open findings). |
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ public sealed class ValkeyConnectionFactory : IAsyncDisposable
|
|||||||
config.KeepAlive = 60; // Send TCP keepalive every 60s
|
config.KeepAlive = 60; // Send TCP keepalive every 60s
|
||||||
config.AsyncTimeout = 15_000; // 15s — async command timeout
|
config.AsyncTimeout = 15_000; // 15s — async command timeout
|
||||||
config.ConnectRetry = _options.ConnectRetry;
|
config.ConnectRetry = _options.ConnectRetry;
|
||||||
|
config.ClientName ??= "stellaops-router-messaging";
|
||||||
|
|
||||||
if (_options.Database.HasValue)
|
if (_options.Database.HasValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,7 +175,9 @@ return {0, maxRetryAfter, outCount, outLimit, outWindow}
|
|||||||
{
|
{
|
||||||
_connection?.Dispose();
|
_connection?.Dispose();
|
||||||
_logger?.LogDebug("Connecting to Valkey at {Endpoint}", _connectionString);
|
_logger?.LogDebug("Connecting to Valkey at {Endpoint}", _connectionString);
|
||||||
_connection = await ConnectionMultiplexer.ConnectAsync(_connectionString).ConfigureAwait(false);
|
var config = ConfigurationOptions.Parse(_connectionString);
|
||||||
|
config.ClientName ??= "stellaops-router-rate-limit";
|
||||||
|
_connection = await ConnectionMultiplexer.ConnectAsync(config).ConfigureAwait(false);
|
||||||
_logger?.LogInformation("Connected to Valkey");
|
_logger?.LogInformation("Connected to Valkey");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,4 +189,3 @@ return {0, maxRetryAfter, outCount, outLimit, outWindow}
|
|||||||
return _connection;
|
return _connection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_sol
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named the gateway rate-limit Valkey client construction path. |
|
||||||
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Libraries/StellaOps.Router.Gateway/StellaOps.Router.Gateway.md. |
|
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Router/__Libraries/StellaOps.Router.Gateway/StellaOps.Router.Gateway.md. |
|
||||||
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ internal sealed class RedisConnectionFactory : IRedisConnectionFactory
|
|||||||
public async ValueTask<IConnectionMultiplexer> ConnectAsync(ConfigurationOptions options, CancellationToken cancellationToken)
|
public async ValueTask<IConnectionMultiplexer> ConnectAsync(ConfigurationOptions options, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(options);
|
ArgumentNullException.ThrowIfNull(options);
|
||||||
|
options.ClientName ??= "stellaops-scanner-events";
|
||||||
var connectTask = ConnectionMultiplexer.ConnectAsync(options);
|
var connectTask = ConnectionMultiplexer.ConnectAsync(options);
|
||||||
var connection = await connectTask.WaitAsync(cancellationToken).ConfigureAwait(false);
|
var connection = await connectTask.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
return connection;
|
return connection;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Source of truth: `docs/implplan/SPRINT_20260112_003_BE_csproj_audit_pending_appl
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named the scanner webservice event Valkey client construction path. |
|
||||||
| QA-SCANNER-VERIFY-008 | DONE | `SPRINT_20260212_002_Scanner_unchecked_feature_verification_batch1.md`: verified entry-trace response contract carries `graph.binaryIntelligence` for scanner binary intelligence feature (run-002, 2026-02-12). |
|
| QA-SCANNER-VERIFY-008 | DONE | `SPRINT_20260212_002_Scanner_unchecked_feature_verification_batch1.md`: verified entry-trace response contract carries `graph.binaryIntelligence` for scanner binary intelligence feature (run-002, 2026-02-12). |
|
||||||
| TODO-WEB-001 | TODO | Load tenant-specific policy configuration in `src/Scanner/StellaOps.Scanner.WebService/Services/VexGateQueryService.cs`. |
|
| TODO-WEB-001 | TODO | Load tenant-specific policy configuration in `src/Scanner/StellaOps.Scanner.WebService/Services/VexGateQueryService.cs`. |
|
||||||
| TODO-WEB-002 | TODO | Implement CAS retrieval for slices in `src/Scanner/StellaOps.Scanner.WebService/Services/SliceQueryService.cs`. |
|
| TODO-WEB-002 | TODO | Implement CAS retrieval for slices in `src/Scanner/StellaOps.Scanner.WebService/Services/SliceQueryService.cs`. |
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ public sealed class ValkeyCallGraphCacheService : ICallGraphCacheService, IAsync
|
|||||||
}
|
}
|
||||||
|
|
||||||
var config = ConfigurationOptions.Parse(_options.ConnectionString);
|
var config = ConfigurationOptions.Parse(_options.ConnectionString);
|
||||||
|
config.ClientName ??= "stellaops-scanner-callgraph-cache";
|
||||||
_connection = await _connectionFactory(config).ConfigureAwait(false);
|
_connection = await _connectionFactory(config).ConfigureAwait(false);
|
||||||
return _connection;
|
return _connection;
|
||||||
}
|
}
|
||||||
@@ -240,4 +241,3 @@ public sealed class ValkeyCallGraphCacheService : ICallGraphCacheService, IAsync
|
|||||||
return output.ToArray();
|
return output.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_sol
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named scanner call-graph cache Valkey client construction. |
|
||||||
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Scanner/__Libraries/StellaOps.Scanner.CallGraph/StellaOps.Scanner.CallGraph.md. |
|
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Scanner/__Libraries/StellaOps.Scanner.CallGraph/StellaOps.Scanner.CallGraph.md. |
|
||||||
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
||||||
|
|||||||
@@ -502,6 +502,7 @@ internal sealed class RedisScanQueue : IScanQueue, IAsyncDisposable
|
|||||||
config.AbortOnConnectFail = false;
|
config.AbortOnConnectFail = false;
|
||||||
config.ConnectTimeout = (int)_options.InitializationTimeout.TotalMilliseconds;
|
config.ConnectTimeout = (int)_options.InitializationTimeout.TotalMilliseconds;
|
||||||
config.ConnectRetry = 3;
|
config.ConnectRetry = 3;
|
||||||
|
config.ClientName ??= "stellaops-scanner-queue";
|
||||||
if (_options.Database is not null)
|
if (_options.Database is not null)
|
||||||
{
|
{
|
||||||
config.DefaultDatabase = _options.Database;
|
config.DefaultDatabase = _options.Database;
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_sol
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named scanner queue Valkey client construction. |
|
||||||
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Scanner/__Libraries/StellaOps.Scanner.Queue/StellaOps.Scanner.Queue.md. |
|
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/Scanner/__Libraries/StellaOps.Scanner.Queue/StellaOps.Scanner.Queue.md. |
|
||||||
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authentication;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using NetEscapades.Configuration.Yaml;
|
using NetEscapades.Configuration.Yaml;
|
||||||
|
using StackExchange.Redis;
|
||||||
using StellaOps.Auth.Abstractions;
|
using StellaOps.Auth.Abstractions;
|
||||||
using StellaOps.Auth.ServerIntegration;
|
using StellaOps.Auth.ServerIntegration;
|
||||||
using StellaOps.Auth.ServerIntegration.Tenancy;
|
using StellaOps.Auth.ServerIntegration.Tenancy;
|
||||||
@@ -133,10 +134,19 @@ builder.Services.AddSingleton<ICallgraphParser>(new SimpleJsonCallgraphParser("g
|
|||||||
builder.Services.AddSingleton<ICallgraphParserResolver, CallgraphParserResolver>();
|
builder.Services.AddSingleton<ICallgraphParserResolver, CallgraphParserResolver>();
|
||||||
builder.Services.AddSingleton<ICallgraphIngestionService, CallgraphIngestionService>();
|
builder.Services.AddSingleton<ICallgraphIngestionService, CallgraphIngestionService>();
|
||||||
builder.Services.AddSingleton<ICallGraphSyncService, CallGraphSyncService>();
|
builder.Services.AddSingleton<ICallGraphSyncService, CallGraphSyncService>();
|
||||||
|
builder.Services.AddSingleton<IConnectionMultiplexer>(sp =>
|
||||||
|
{
|
||||||
|
var options = sp.GetRequiredService<IOptions<SignalsOptions>>().Value;
|
||||||
|
var configuration = ConfigurationOptions.Parse(options.Cache.ConnectionString);
|
||||||
|
configuration.ClientName ??= "stellaops-signals-cache";
|
||||||
|
return ConnectionMultiplexer.Connect(configuration);
|
||||||
|
});
|
||||||
builder.Services.AddSingleton<IReachabilityCache>(sp =>
|
builder.Services.AddSingleton<IReachabilityCache>(sp =>
|
||||||
{
|
{
|
||||||
var options = sp.GetRequiredService<IOptions<SignalsOptions>>().Value;
|
var options = sp.GetRequiredService<IOptions<SignalsOptions>>().Value;
|
||||||
return new RedisReachabilityCache(options.Cache);
|
return new RedisReachabilityCache(
|
||||||
|
options.Cache,
|
||||||
|
sp.GetRequiredService<IConnectionMultiplexer>());
|
||||||
});
|
});
|
||||||
builder.Services.AddSingleton<IRedisConnectionFactory, RedisConnectionFactory>();
|
builder.Services.AddSingleton<IRedisConnectionFactory, RedisConnectionFactory>();
|
||||||
builder.Services.AddSingleton<ReachabilityFactEventBuilder>();
|
builder.Services.AddSingleton<ReachabilityFactEventBuilder>();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ internal sealed class RedisConnectionFactory : IRedisConnectionFactory
|
|||||||
public async Task<IConnectionMultiplexer> ConnectAsync(ConfigurationOptions options, CancellationToken cancellationToken)
|
public async Task<IConnectionMultiplexer> ConnectAsync(ConfigurationOptions options, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
options.ClientName ??= "stellaops-signals-events";
|
||||||
return await ConnectionMultiplexer.ConnectAsync(options).ConfigureAwait(false);
|
return await ConnectionMultiplexer.ConnectAsync(options).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,21 +9,19 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StellaOps.Signals.Services;
|
namespace StellaOps.Signals.Services;
|
||||||
|
|
||||||
internal sealed class RedisReachabilityCache : IReachabilityCache, IDisposable
|
internal sealed class RedisReachabilityCache : IReachabilityCache
|
||||||
{
|
{
|
||||||
private readonly SignalsCacheOptions options;
|
private readonly SignalsCacheOptions options;
|
||||||
private readonly ConnectionMultiplexer multiplexer;
|
|
||||||
private readonly IDatabase database;
|
private readonly IDatabase database;
|
||||||
private static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.Web)
|
private static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.Web)
|
||||||
{
|
{
|
||||||
WriteIndented = false
|
WriteIndented = false
|
||||||
};
|
};
|
||||||
|
|
||||||
public RedisReachabilityCache(SignalsCacheOptions options)
|
public RedisReachabilityCache(SignalsCacheOptions options, IConnectionMultiplexer multiplexer)
|
||||||
{
|
{
|
||||||
this.options = options ?? throw new ArgumentNullException(nameof(options));
|
this.options = options ?? throw new ArgumentNullException(nameof(options));
|
||||||
multiplexer = ConnectionMultiplexer.Connect(options.ConnectionString);
|
this.database = (multiplexer ?? throw new ArgumentNullException(nameof(multiplexer))).GetDatabase();
|
||||||
database = multiplexer.GetDatabase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ReachabilityFactDocument?> GetAsync(string subjectKey, CancellationToken cancellationToken)
|
public async Task<ReachabilityFactDocument?> GetAsync(string subjectKey, CancellationToken cancellationToken)
|
||||||
@@ -68,10 +66,5 @@ internal sealed class RedisReachabilityCache : IReachabilityCache, IDisposable
|
|||||||
await database.KeyDeleteAsync(GetCacheKey(subjectKey)).ConfigureAwait(false);
|
await database.KeyDeleteAsync(GetCacheKey(subjectKey)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
multiplexer?.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetCacheKey(string subjectKey) => $"reachability_cache:{subjectKey}";
|
private static string GetCacheKey(string subjectKey) => $"reachability_cache:{subjectKey}";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ Source of truth: `docs/implplan/SPRINT_20260112_003_BE_csproj_audit_pending_appl
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named Signals cache/events Valkey clients and moved the reachability cache onto a shared DI multiplexer. |
|
||||||
| AUDIT-HOTLIST-SIGNALS-0001 | DONE | Hotlist apply for `src/Signals/StellaOps.Signals/StellaOps.Signals.csproj`; audit tracker updated. |
|
| AUDIT-HOTLIST-SIGNALS-0001 | DONE | Hotlist apply for `src/Signals/StellaOps.Signals/StellaOps.Signals.csproj`; audit tracker updated. |
|
||||||
| MWD-001 | DONE | Implemented deterministic BTF fallback selection and metadata emission for runtime eBPF collection (`source_kind`, `source_path`, `source_digest`, `selection_reason`); verified with Signals and Scanner tests. |
|
| MWD-001 | DONE | Implemented deterministic BTF fallback selection and metadata emission for runtime eBPF collection (`source_kind`, `source_path`, `source_digest`, `selection_reason`); verified with Signals and Scanner tests. |
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ public sealed class RedisTimelineEventSubscriber : ITimelineEventSubscriber, IAs
|
|||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_connection = await ConnectionMultiplexer.ConnectAsync(cfg.ConnectionString);
|
var redisOptions = ConfigurationOptions.Parse(cfg.ConnectionString);
|
||||||
|
redisOptions.ClientName ??= "stellaops-timeline-indexer-subscriber";
|
||||||
|
_connection = await ConnectionMultiplexer.ConnectAsync(redisOptions);
|
||||||
var db = _connection.GetDatabase();
|
var db = _connection.GetDatabase();
|
||||||
|
|
||||||
await EnsureGroupAsync(db, cfg, cancellationToken).ConfigureAwait(false);
|
await EnsureGroupAsync(db, cfg, cancellationToken).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Source of truth:
|
|||||||
|
|
||||||
| Task ID | Status | Notes |
|
| Task ID | Status | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| SPRINT_20260405_011-XPORT-VALKEY | DONE | `docs/implplan/SPRINT_20260405_011___Libraries_transport_pooling_and_attribution_hardening.md`: named the Timeline indexer Valkey subscription client. |
|
||||||
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/TimelineIndexer/StellaOps.TimelineIndexer/StellaOps.TimelineIndexer.Infrastructure/StellaOps.TimelineIndexer.Infrastructure.md. |
|
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/TimelineIndexer/StellaOps.TimelineIndexer/StellaOps.TimelineIndexer.Infrastructure/StellaOps.TimelineIndexer.Infrastructure.md. |
|
||||||
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
||||||
| TLI-EF-01 | DONE | EF Core scaffold baseline generated for timeline schema tables. |
|
| TLI-EF-01 | DONE | EF Core scaffold baseline generated for timeline schema tables. |
|
||||||
|
|||||||
Reference in New Issue
Block a user