Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new .NET 10 “Telemetry Server for pyRevit” Web API, including database persistence (multiple providers), Docker deployment assets, and an initial unit/integration test suite.
Changes:
- Added
Telemetry.ApiWeb API with v2 endpoints (/scripts,/events,/status), Swagger, Prometheus metrics, logging, and a DB context abstraction. - Added EF Core migrations projects for PostgreSQL, SQL Server, SQLite, and Oracle.
- Added TUnit-based unit and integration tests, plus Docker Compose configurations and CI workflows.
Reviewed changes
Copilot reviewed 73 out of 79 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Telemetry.Api.UnitTests/Web/Controllers/TelemetryControllerTests.cs | Unit tests for controller endpoints |
| tests/Telemetry.Api.UnitTests/Telemetry.Api.UnitTests.csproj | Unit test project definition |
| tests/Telemetry.Api.UnitTests/Application/Mappings/TelemetryMappingExtensionsTests.cs | Unit tests for DTO↔model mappings |
| tests/Telemetry.Api.IntegrationTests/Telemetry.Api.IntegrationTests.csproj | Integration test project definition |
| tests/Telemetry.Api.IntegrationTests/SqliteIntegrationTests.cs | SQLite end-to-end API tests |
| tests/Telemetry.Api.IntegrationTests/PostgresIntegrationTests.cs | PostgreSQL end-to-end API tests |
| tests/Telemetry.Api.IntegrationTests/OracleIntegrationTests.cs | Oracle end-to-end API tests |
| tests/Telemetry.Api.IntegrationTests/MsSqlIntegrationTests.cs | SQL Server end-to-end API tests |
| tests/Telemetry.Api.IntegrationTests/MongoDbIntegrationTests.cs | MongoDB end-to-end API tests |
| tests/Telemetry.Api.IntegrationTests/BaseIntegrationTest.cs | Shared WebApplicationFactory integration test base |
| telemetry-server.slnx | Solution definition including src/tests projects |
| src/Telemetry.Migrations.SqlServer/Telemetry.Migrations.SqlServer.csproj | SQL Server migrations project |
| src/Telemetry.Migrations.SqlServer/Migrations/ApplicationDbContextModelSnapshot.cs | SQL Server EF model snapshot |
| src/Telemetry.Migrations.SqlServer/Migrations/20260330090733_InitSqlServer.Designer.cs | SQL Server migration designer |
| src/Telemetry.Migrations.SqlServer/Migrations/20260330090733_InitSqlServer.cs | SQL Server initial migration |
| src/Telemetry.Migrations.Sqlite/Telemetry.Migrations.Sqlite.csproj | SQLite migrations project |
| src/Telemetry.Migrations.Sqlite/Migrations/ApplicationDbContextModelSnapshot.cs | SQLite EF model snapshot |
| src/Telemetry.Migrations.Sqlite/Migrations/20260330090723_InitSqlite.Designer.cs | SQLite migration designer |
| src/Telemetry.Migrations.Sqlite/Migrations/20260330090723_InitSqlite.cs | SQLite initial migration |
| src/Telemetry.Migrations.Postgres/Telemetry.Migrations.Postgres.csproj | Postgres migrations project |
| src/Telemetry.Migrations.Postgres/Migrations/ApplicationDbContextModelSnapshot.cs | Postgres EF model snapshot |
| src/Telemetry.Migrations.Postgres/Migrations/20260330090711_InitPostgres.Designer.cs | Postgres migration designer |
| src/Telemetry.Migrations.Postgres/Migrations/20260330090711_InitPostgres.cs | Postgres initial migration |
| src/Telemetry.Migrations.Oracle/Telemetry.Migrations.Oracle.csproj | Oracle migrations project |
| src/Telemetry.Migrations.Oracle/Migrations/ApplicationDbContextModelSnapshot.cs | Oracle EF model snapshot |
| src/Telemetry.Migrations.Oracle/Migrations/20260330090657_InitOracle.Designer.cs | Oracle migration designer |
| src/Telemetry.Migrations.Oracle/Migrations/20260330090657_InitOracle.cs | Oracle initial migration |
| src/Telemetry.Api/Web/Middleware/ExceptionHandlingMiddleware.cs | Custom exception-handling middleware |
| src/Telemetry.Api/Web/Controllers/TelemetryController.cs | v2 telemetry API controller |
| src/Telemetry.Api/Telemetry.Api.http | Example HTTP requests for API testing |
| src/Telemetry.Api/Telemetry.Api.csproj | Main Web API project definition |
| src/Telemetry.Api/Properties/launchSettings.json | Local launch profiles |
| src/Telemetry.Api/Program.cs | App bootstrap: DI, DB providers, Swagger, metrics, logging, migrations |
| src/Telemetry.Api/JsonConverters/DynamicDataJsonConverter.cs | JSON converter for “dynamic JSON to string” |
| src/Telemetry.Api/JsonConverters/DynamicDataBsonSerializer.cs | MongoDB BSON serializer for “dynamic JSON to string” |
| src/Telemetry.Api/Infrastructure/Persistence/ApplicationDbContext.cs | EF Core DbContext + schema mapping + DB status helpers |
| src/Telemetry.Api/Domain/Models/TraceInfo.cs | Domain model: trace info |
| src/Telemetry.Api/Domain/Models/ScriptRecord.cs | Domain model: script telemetry record |
| src/Telemetry.Api/Domain/Models/MetaRecord.cs | Domain model: metadata record |
| src/Telemetry.Api/Domain/Models/EventRecord.cs | Domain model: event telemetry record |
| src/Telemetry.Api/Domain/Models/EngineInfo.cs | Domain model: engine info |
| src/Telemetry.Api/Dockerfile | Multi-stage Docker build/publish |
| src/Telemetry.Api/appsettings.json | Base app config |
| src/Telemetry.Api/appsettings.Development.json | Development config |
| src/Telemetry.Api/Application/Services/ServiceInfo.cs | Service identity provider |
| src/Telemetry.Api/Application/Mappings/TelemetryMappingExtensions.cs | DTO↔domain mapping extensions |
| src/Telemetry.Api/Application/Interfaces/IServiceInfo.cs | Service info interface |
| src/Telemetry.Api/Application/Interfaces/IApplicationDbContext.cs | DbContext abstraction interface |
| src/Telemetry.Api/Application/DTOs/TraceInfoDto.cs | API DTO: trace info |
| src/Telemetry.Api/Application/DTOs/StatusRecordDto.cs | API DTO: status payload |
| src/Telemetry.Api/Application/DTOs/ScriptRecordDto.cs | API DTO: script record |
| src/Telemetry.Api/Application/DTOs/MetaDto.cs | API DTO: metadata |
| src/Telemetry.Api/Application/DTOs/EventRecordDto.cs | API DTO: event record |
| src/Telemetry.Api/Application/DTOs/EngineInfoDto.cs | API DTO: engine info |
| src/Telemetry.Api/.dockerignore | Docker ignore for API subdir |
| SECURITY.md | Security policy / reporting guidance |
| README.md | Expanded project documentation |
| global.json | SDK pinning + test runner config |
| docker-compose.yml | Base compose for API container |
| docker-compose.sqlite.yml | SQLite compose overlay |
| docker-compose.postgres.yml | Postgres compose overlay |
| docker-compose.oracle.yml | Oracle compose overlay |
| docker-compose.mssql.yml | SQL Server compose overlay |
| docker-compose.mongodb.yml | MongoDB compose overlay |
| Directory.Packages.props | Central package version management |
| Directory.Build.targets | Build targets placeholder |
| Directory.Build.props | Assembly/package version settings |
| CREDITS.md | Credits link |
| CONTRIBUTING.md | Contribution guidance link |
| CODE_OF_CONDUCT.md | Contributor covenant |
| .gitignore | Updated ignore rules for .NET tooling/artifacts |
| .github/workflows/tests.yml | CI workflow to build/test |
| .github/workflows/release.yml | Release + Docker publish workflow |
| .github/workflows/build.yml | Build + prerelease Docker publish workflow |
| .gitattributes | Line ending / diff settings |
| .env.example | Example environment variables |
| .editorconfig | C# formatting and conventions |
| .dockerignore | Root docker ignore rules |
Files not reviewed (4)
- src/Telemetry.Migrations.Oracle/Migrations/20260330090657_InitOracle.Designer.cs: Language not supported
- src/Telemetry.Migrations.Postgres/Migrations/20260330090711_InitPostgres.Designer.cs: Language not supported
- src/Telemetry.Migrations.SqlServer/Migrations/20260330090733_InitSqlServer.Designer.cs: Language not supported
- src/Telemetry.Migrations.Sqlite/Migrations/20260330090723_InitSqlite.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/Telemetry.Api.UnitTests/Web/Controllers/TelemetryControllerTests.cs
Show resolved
Hide resolved
tests/Telemetry.Api.UnitTests/Web/Controllers/TelemetryControllerTests.cs
Show resolved
Hide resolved
tests/Telemetry.Api.UnitTests/Web/Controllers/TelemetryControllerTests.cs
Show resolved
Hide resolved
…sistency and modularity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Telemetry Server for pyRevit
A high-performance .NET 10 Web API service designed to collect and store telemetry data
from pyRevit. It supports multiple database providers and can be easily
deployed using Docker.
Project Structure
The project follows a Clean Architecture approach:
Prerequisites
Compilation
To build the project locally, run the following command from the root directory:
To run the application:
Docker Deployment
The project provides several Docker Compose configurations to support different database backends.
General Usage
To start the API using the pre-built image, you can pull the latest version:
To start the API with a specific database, use the following command structure:
Supported Database Variants
docker compose -f docker-compose.yml -f docker-compose.postgres.yml up -ddocker compose -f docker-compose.yml -f docker-compose.mssql.yml up -ddocker compose -f docker-compose.yml -f docker-compose.sqlite.yml up -ddocker compose -f docker-compose.yml -f docker-compose.oracle.yml up -ddocker compose -f docker-compose.yml -f docker-compose.mongodb.yml up -dEnvironment Variables
Each database variant requires specific environment variables (usually defined in a
.envfile or passed directly). Keyvariables include:
DbProvider: Specifies the database provider (e.g.,postgres,mssql,sqlite,oracle,mongodb).ConnectionStrings__DefaultConnection: The connection string for the selected database.ASPNETCORE_HTTP_PORTS: The port the API listens to on (default:8080).API Endpoints
The API is versioned (currently
v2).POST /api/v2/scripts: Submit pyRevit script execution telemetry.POST /api/v2/events: Submit pyRevit event telemetry.GET /api/v2/status: Check service and database connection status.GET /metrics: Prometheus metrics for monitoring.GET /swagger: OpenAPI/Swagger documentation (in Development mode).API Documentation
When running in Development mode, the application provides interactive API documentation using Swagger (OpenAPI).
To access the Swagger UI:
ASPNETCORE_ENVIRONMENT=Development).http://localhost:8080/swagger(or your configured port).From the Swagger UI, you can explore all available endpoints, view request/response schemas, and test the API directly from your browser.
Monitoring
The application exposes Prometheus metrics at the
/metricsendpoint. This can be used to monitor the service's health, request rates, and performance using Prometheus and Grafana.To view the metrics:
http://localhost:8080/metrics(or your configured port).Testing
The project uses TUnit, a modern testing framework for .NET, taking advantage of
the latest features in .NET 10.
Unit Tests
Unit tests focus on isolated business logic and data mappings. They do not require any external dependencies.
To run unit tests:
Integration Tests
Integration tests verify the end-to-end functionality of the API, including database persistence. These tests
use Testcontainers to spin up actual database instances (except for SQLite) during the
test execution.
Prerequisites: Docker must be running on your machine to execute integration tests for PostgreSQL, SQL Server,
Oracle, and MongoDB.
To run integration tests:
Manual Deployment (Without Docker)
To run the server manually, follow these steps to build, configure, and publish the application.
Build and Publish
Publish the project:
Run the following command to create a self-contained or framework-dependent deployment:
Navigate to the publish directory:
cd ./publishConfiguration (appsettings.json)
Before running the server, you must configure the database provider and connection string in
appsettings.json.Open
appsettings.jsonand add the following configuration:{ "DbProvider": "postgres", "ConnectionStrings": { "DefaultConnection": "Host=localhost;Database=telemetry;Username=postgres;Password=password" }, "MongoDbDatabaseName": "telemetry", "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*" }Configuration Options:
DbProvider: Set to one ofpostgres,mssql,sqlite,oracle,mongodb.ConnectionStrings:DefaultConnection: Provide the appropriate connection string for your database.MongoDbDatabaseName: (Optional) Required only if usingmongodb.Running the Server
Start the application using the
dotnetCLI:The server will start and listen on the default ports (usually
http://localhost:5000or as configured via environment variables).Database Migrations
The project uses Entity Framework Core (EF Core) to manage relational database schemas (PostgreSQL, SQL Server, SQLite, Oracle).
Prerequisites
You need the
dotnet-eftool installed globally:Creating a New Migration
If you modify the data models in the
DomainorInfrastructurelayers, you need to generate a new migration for each supported database provider. Each database has its own project for migrations.To generate migrations correctly, set the required environment variables for the target database and run the
dotnet ef migrations addcommand from the root directory.Oracle
PostgreSQL
SQLite
SQL Server
Reviewing the generated files
New migration files will be created in their respective projects under the
Migrationsdirectory (e.g.,src/Telemetry.Migrations.Postgres/Migrations).Applying Migrations
Automatic: The server automatically applies pending migrations on startup for all relational database providers.
Manual: You can manually update the database using the following command (example for SQLite):
DbProvider=sqlite ConnectionStrings__DefaultConnection="Data Source=/app/data/telemetry.db" \ dotnet ef database update \ --project src/Telemetry.Migrations.Sqlite \ --startup-project src/Telemetry.Api \ --context ApplicationDbContext