Skip to content

Migrate diagnostics persistence to Groundwork#660

Draft
sfmskywalker wants to merge 26 commits into
mainfrom
091-groundwork-diagnostics-persistence
Draft

Migrate diagnostics persistence to Groundwork#660
sfmskywalker wants to merge 26 commits into
mainfrom
091-groundwork-diagnostics-persistence

Conversation

@sfmskywalker

@sfmskywalker sfmskywalker commented Jul 13, 2026

Copy link
Copy Markdown
Member

References #642.

This draft carries the ratified Spec Kit work unit for replacing Structured Logs and OpenTelemetry EF Core persistence with Groundwork while diagnostics core contracts remain provider-neutral.

Reviewed checkpoints now on the branch

  • provider-neutral diagnostics drain with bounded queue, retry, retention, shutdown, durable acknowledgement, and subscriber-loss classification
  • explicit default-versus-replacement registration semantics and startup conflict validation
  • Structured Logs Groundwork persistence coverage
  • restart-safe OpenTelemetry immutable-signal capture over Groundwork diagnostic streams
  • durable batch/stream ledger with conflict, expiry, partial-restart, cancellation, and corruption handling
  • provider-neutral OpenTelemetry persistence exception taxonomy; Groundwork/provider exceptions remain inner details
  • storage definitions validated through the actual Groundwork SQL Server resolution/compiler/store path
  • Groundwork packages aligned to 0.0.1-preview.41

Current verification

  • OpenTelemetry Groundwork: 40/40
  • OpenTelemetry persistence contracts: 16/16
  • shared diagnostics persistence: 75/75
  • Structured Logs Groundwork: 9/9
  • architecture: 90/90
  • full Release Elsa.Server.slnx build: 0 errors

Why this remains draft

The remaining OpenTelemetry catalog and case-insensitive query surface depends on Groundwork #70 and #71. After consuming those releases, this work unit still must complete production registration, four-provider conformance, EF-oracle/performance evidence, and deletion of the diagnostics EF implementation/package/migrations. Issue #642 remains open until those gates pass.

@sfmskywalker sfmskywalker force-pushed the 091-groundwork-diagnostics-persistence branch from c2a5fdf to 00673a6 Compare July 14, 2026 00:22

private async Task<DiagnosticsProviderLease> CreateMongoDbAsync(string databaseName, CancellationToken cancellationToken)
{
var client = new MongoClient(_mongoDb.GetConnectionString());
}

private static string RepositoryPath(string relativePath, [CallerFilePath] string sourceFile = "") =>
Path.GetFullPath(Path.Combine(Path.GetDirectoryName(sourceFile)!, "../../../../..", relativePath));

private async Task<DiagnosticsProviderLease> CreateSqliteAsync(string databaseName, CancellationToken cancellationToken)
{
var path = Path.Combine(Path.GetTempPath(), $"{databaseName}.db");
Comment thread src/Elsa/Diagnostics/Persistence/Draining/DiagnosticsDrain.cs Fixed
Comment thread src/Elsa/Diagnostics/Persistence/Draining/DiagnosticsDrain.cs Fixed
Comment thread src/Elsa/Diagnostics/Persistence/Draining/DiagnosticsDrain.cs Fixed
Comment thread src/Elsa/Diagnostics/Persistence/Draining/DiagnosticsDrain.cs Fixed
Comment thread src/Elsa/Diagnostics/Persistence/Draining/DiagnosticsDrain.cs Fixed
Comment thread src/Elsa/Diagnostics/Persistence/Draining/DiagnosticsDrain.cs Fixed
@gitguardian

gitguardian Bot commented Jul 14, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
34806143 Triggered Generic Password f26210a tests/Elsa/Diagnostics/OpenTelemetry/Persistence/Groundwork/Tests/OpenTelemetryGroundworkStorageSchemaTests.cs View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Comment on lines +219 to +224
foreach (var attribute in attributes)
{
var value = Required(attribute, "attribute");
if (value.Key is null || !result.TryAdd(value.Key, value.Value))
throw new CatalogPayloadException("The OpenTelemetry catalog contains an invalid or duplicate attribute key.");
}
Comment on lines +552 to +564
foreach (var value in values)
{
var record = map(value);
if (result.TryGetValue(record.RecordId, out var existing))
{
if (!RecordEquals(existing, record))
throw new ArgumentException(
$"OpenTelemetry record id '{record.RecordId}' identifies conflicting payloads in one batch.",
nameof(values));
continue;
}
result.Add(record.RecordId, record);
}
Comment on lines +406 to +411
foreach (var attribute in attributes)
{
var value = Required(attribute, "attribute");
if (value.Key is null || !result.TryAdd(value.Key, value.Value))
throw new RecordPayloadException("The OpenTelemetry record contains an invalid or duplicate attribute key.");
}
Comment on lines +12 to +14
private readonly string _databasePath = Path.Combine(
Path.GetTempPath(),
$"elsa-open-telemetry-{Guid.NewGuid():N}.db");
Comment on lines +36 to +38
private readonly string _databasePath = Path.Combine(
Path.GetTempPath(),
$"elsa-diagnostics-operations-{Guid.NewGuid():N}.db");
Comment on lines +147 to +149
private readonly string _databasePath = Path.Combine(
Path.GetTempPath(),
$"elsa-structured-logs-{Guid.NewGuid():N}.db");
Comment on lines +169 to +172
catch (Exception exception)
{
throw TranslateFailure("write", context, exception);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant