Skip to main content
The qyl API provides programmatic access to telemetry data collected by the qyl observability platform. Query distributed traces, search logs, analyze metrics, and track deployments through a consistent REST interface.

Quick Start

Fetch the 10 most recent traces:
curl "https://qyl-api-production.up.railway.app/v1/traces?limit=10"

Base URLs

EnvironmentURLDescription
Productionhttps://qyl-api-production.up.railway.appProduction API (Railway)
Localhttp://localhost:5100Local collector instance

Authentication

The API is currently public and requires no authentication. For production deployments, place qyl behind a reverse proxy with your preferred authentication mechanism.

API Versioning

The API uses date-based versioning in the URL path:
VersionDateDescription
v12024-01-01Initial API
v22024-06-01GenAI observability support
v32025-01-01Full OTel v1.39 compliance
All endpoints use the /v1/ prefix. Breaking changes introduce new versions while maintaining backwards compatibility.

Endpoints

CategoryDescription
TracesQuery distributed traces and spans
LogsSearch, filter, and aggregate log records
MetricsQuery time-series metrics with aggregations
SessionsTrack user sessions and their traces
ErrorsManage error groups with status tracking
DeploymentsTrack deployments and calculate DORA metrics
ServicesDiscover services and their dependencies
StreamingReal-time telemetry via Server-Sent Events

Endpoint Summary

CategoryEndpointsOperations
Health3Health check, liveness probe, readiness probe
Traces4List, get by ID, get spans, search
Logs5List, search, aggregate, patterns, stats
Metrics3List, query time-series, get metadata
Sessions4List, get by ID, get traces, stats
Errors5List, get, update status, stats, correlations
Exceptions2List, stats
Deployments5List, get, create, update, DORA metrics
CI/CD2List pipeline runs, stats
Services4List, get details, dependencies, operations
Streaming7SSE streams for traces, logs, metrics, and more

Pagination

All list endpoints support cursor-based pagination:
curl "https://qyl-api-production.up.railway.app/v1/traces?limit=50"
ParameterTypeDefaultMaxDescription
limitinteger1001000Maximum items per page
cursorstringOpaque cursor from previous page

Response Headers

Every response includes correlation headers for debugging:
HeaderDescription
X-Trace-IdDistributed trace ID for the request
X-Request-IdUnique request ID for support reference
Include these headers when reporting issues. They help trace the request through the system.

Error Handling

Errors follow the RFC 7807 Problem Details format:
{
  "type": "https://qyl.dev/errors/validation-failed",
  "title": "Validation Failed",
  "status": 400,
  "detail": "The 'limit' parameter must be between 1 and 1000",
  "instance": "/v1/traces?limit=5000",
  "trace_id": "abc123",
  "request_id": "req_xyz789",
  "timestamp": "2025-01-15T10:30:00Z",
  "errors": [
    {
      "field": "limit",
      "message": "Value must be at most 1000",
      "code": "max_value",
      "rejected_value": "5000"
    }
  ]
}

Status Codes

StatusTypeDescription
200Success
400ValidationErrorInvalid request parameters
404NotFoundErrorResource not found
409ConflictErrorResource state conflict
429RateLimitErrorToo many requests (includes Retry-After)
500InternalServerErrorServer error (include request_id in reports)
503ServiceUnavailableErrorTemporarily unavailable

Real-time Streaming

Subscribe to telemetry events in real-time using Server-Sent Events (SSE):
curl -N "https://qyl-api-production.up.railway.app/v1/stream/events?types=traces,logs"
Events are delivered as JSON with a type discriminator:
data: {"type":"trace","data":{...},"timestamp":"2025-01-15T10:30:00Z"}

data: {"type":"log","data":{...},"timestamp":"2025-01-15T10:30:01Z"}

data: {"type":"heartbeat","timestamp":"2025-01-15T10:30:30Z"}
Available event types: traces, spans, logs, metrics, exceptions, deployments, all

Schema Architecture

The API schema follows a single source of truth pattern: TypeSpec definitions generate everything.

Generated Artifacts

OutputPathDescription
OpenAPI Speccore/openapi/openapi.yamlREST API definition
C# Scalarsqyl.protocol/Primitives/Scalars.g.csTraceId, SpanId with IParsable<T>
C# Enumsqyl.protocol/Enums/Enums.g.csOTel 1.39 semantic conventions
C# Modelsqyl.protocol/Models/*.g.csRequest/response records
DuckDB Schemaqyl.collector/Storage/DuckDbSchema.g.csDDL with indexes
TypeScriptqyl.dashboard/src/types/api.tsFrontend types

Code Generation

The SchemaGenerator transforms OpenAPI into production-quality C#:
  • Strongly-typed scalars with IParsable<T>, ISpanFormattable
  • Hex parsing for TraceId/SpanId (hot-path optimized with ReadOnlySpan<byte>)
  • JSON converters for all primitive types
  • DuckDB DDL with proper indexes
  • Generation guard for CI/local workflows (detects stale files)
# Generate all artifacts
nuke Generate

# Force regenerate (required for CI)
nuke Generate --force-generate
Never edit *.g.cs files directly. Modify the TypeSpec definitions in core/specs/ and regenerate.

SDK & Tools

ToolDescription
MCPConnect AI agents to qyl telemetry
DashboardVisual exploration of telemetry data
CollectorIngest OTLP telemetry data