Skip to content

[Repo Assist] Better OTel and use Pull Diagnostics (rebased + dotnet test fix)Β #1480

@github-actions

Description

@github-actions

πŸ€– This is a PR from Repo Assist, an automated AI assistant.

This PR rebases #1341 ("Better OTel and use Pull Diagnostics") onto current main and completes the remaining work items requested by @TheAngryByrd.

Changes from the original PR

The original PR (#1341) introduced:

  • Better OpenTelemetry tracing for tests
  • Pull-based diagnostics
  • A custom file exporter for failed test traces
  • Upload of failed traces as CI artifacts

However, it had switched from dotnet test to dotnet run and had formatting issues.

What this PR adds on top

Convert back to dotnet test

The CI workflow now uses dotnet test again (with YoloDev.Expecto.TestSdk), restoring:

  • AltCover code coverage
  • GitHubActions test logger (inline test annotations)
  • --blame-hang --blame-hang-timeout 1m for hung-test detection

OTel still works because the trace provider is now initialised at F# module level (via a do block) rather than inside main(). This means it is initialised before the test runner discovers and executes tests, regardless of whether the process is started by dotnet run or the VSTest host used by dotnet test.

Module-level OTel initialisation

  • CI mode (CI=true): FailedTestOtlpFileExportProcessor is created at module load, registers an AppDomain.ProcessExit handler to write OTLP JSON files and print a ::error:: annotation.
  • Local dev: reads the standard OTEL_EXPORTER_OTLP_ENDPOINT env var instead of a hard-coded localhost:4317, making it easier to point at any OTLP backend.

Failed trace upload

Kept from the original PR: on failure(), CI uploads the contents of ${{ github.workspace }}/failed_traces/ as a workflow artifact (7-day retention). The path now uses the absolute github.workspace variable for correctness.

Formatting

Fixed fantomas formatting in:

  • src/FsAutoComplete.Logging/FsOpenTelemetry.fs
  • src/FsAutoComplete/LspServers/AdaptiveServerState.fsi

Test Status

Build: βœ… dotnet build β€” 0 errors, 0 warnings
Format: βœ… dotnet fantomas --check build.fsx src β€” clean
Tests: ⏳ Full test run requires CI (the LSP integration tests take ~40 min)

Closes / supersedes #1341

Generated by Repo Assist

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available in the agent-artifacts artifact in the workflow run linked above.

To apply the patch locally:

# Download the artifact from the workflow run https://github.com/ionide/FsAutoComplete/actions/runs/22451371409
# (Use GitHub MCP tools if gh CLI is not available)
gh run download 22451371409 -n agent-artifacts -D /tmp/agent-artifacts-22451371409

# The patch file will be at agent-artifacts/tmp/gh-aw/aw-repo-assist-rebase-pr-1341.patch after download
# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22451371409/aw-repo-assist-rebase-pr-1341.patch
Show patch preview (500 of 3142 lines)
From 306abe67d29f5e67ed1999a42840dd456d08516c Mon Sep 17 00:00:00 2001
From: Jimmy Byrd <jimmy.byrd@motivity.net>
Date: Sun, 12 Jan 2025 20:49:31 -0500
Subject: [PATCH 1/4] Better OTel and use Pull Diagnostics

---
 docker-compose.yml                            |  33 ++
 .../CompilerServiceInterface.fs               |  48 ++-
 src/FsAutoComplete.Logging/FsOpenTelemetry.fs |  11 +-
 .../LspServers/AdaptiveFSharpLspServer.fs     |  37 +-
 .../LspServers/AdaptiveServerState.fs         | 322 ++++++++++++------
 .../LspServers/AdaptiveServerState.fsi        |   4 +
 .../EmptyFileTests.fs                         |   2 -
 .../Expecto.OpenTelemetry.fs                  | 201 +++++++++++
 .../ExtensionsTests.fs                        |   1 -
 .../FsAutoComplete.Tests.Lsp.fsproj           |   1 +
 test/FsAutoComplete.Tests.Lsp/Helpers.fs      |   1 -
 test/FsAutoComplete.Tests.Lsp/Program.fs      |  50 ++-
 test/FsAutoComplete.Tests.Lsp/ScriptTests.fs  |   2 -
 test/FsAutoComplete.Tests.Lsp/Utils/Server.fs |  70 ++--
 14 files changed, 617 insertions(+), 166 deletions(-)
 create mode 100644 docker-compose.yml
 create mode 100644 test/FsAutoComplete.Tests.Lsp/Expecto.OpenTelemetry.fs

diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 00000000..1ca0fe2e
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,33 @@
+services:
+  seq:
+    profiles:
+      - seq
+    image: datalust/seq
+    ports:
+      - 5341:80 # http and collection
+    environment:
+      - ACCEPT_EULA=Y
+    # http://localhost:5341
+    # OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:5341/ingest/otlp/v1/logs
+    # OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
+    # OTEL_EXPORTER_OTLP_HEADERS="X-Seq-ApiKey=your_api_key"
+  jaeger:
+    profiles:
+      - jaeger
+    image: jaegertracing/all-in-one
+    ports:
+      - 6831:6831/udp
+      - 6832:6832/udp
+      - 5778:5778
+      - 16686:16686
+      - 4317:4317
+      - 4318:4318
+      - 14250:14250
+      - 14268:14268
+      - 1426
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions