diff --git a/core/collector/Storage/DuckDbSchema.g.cs b/core/collector/Storage/DuckDbSchema.g.cs deleted file mode 100644 index 2ec8e900b..000000000 --- a/core/collector/Storage/DuckDbSchema.g.cs +++ /dev/null @@ -1,119 +0,0 @@ -// ============================================================================= -// AUTO-GENERATED FILE - DO NOT EDIT -// ============================================================================= -// Source: /Users/ancplua/qyl/core/openapi/openapi.yaml -// Generated: 2026-01-16T09:00:34.9395810+00:00 -// DuckDB schema definitions -// ============================================================================= - -#nullable enable - -namespace Qyl.Collector.Storage; - -/// DuckDB schema from OpenAPI. -public static partial class DuckDbSchema -{ - public const string DeploymentsDdl = """ - CREATE TABLE IF NOT EXISTS deployments ( - deployment.id VARCHAR NOT NULL, - service.name VARCHAR NOT NULL, - service.version VARCHAR NOT NULL, - environment VARCHAR NOT NULL, - status VARCHAR NOT NULL, - strategy VARCHAR NOT NULL, - start_time TIMESTAMP NOT NULL, - end_time TIMESTAMP, - duration_s VARCHAR, - deployed_by VARCHAR, - git_commit VARCHAR, - git_branch VARCHAR, - previous_version VARCHAR, - rollback_target VARCHAR, - replica_count INTEGER, - healthy_replicas INTEGER, - error_message VARCHAR, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP - ); - """; - - public const string ErrorsDdl = """ - CREATE TABLE IF NOT EXISTS errors ( - error_id VARCHAR NOT NULL, - error.type VARCHAR NOT NULL, - message VARCHAR NOT NULL, - category VARCHAR NOT NULL, - fingerprint VARCHAR NOT NULL, - first_seen TIMESTAMP NOT NULL, - last_seen TIMESTAMP NOT NULL, - occurrence_count BIGINT NOT NULL, - affected_users BIGINT, - affected_services VARCHAR, - status VARCHAR NOT NULL, - assigned_to VARCHAR, - issue_url VARCHAR, - sample_traces VARCHAR, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP - ); - """; - - public const string LogsDdl = """ - CREATE TABLE IF NOT EXISTS logs ( - time_unix_nano BIGINT NOT NULL, - observed_time_unix_nano BIGINT NOT NULL, - severity_number VARCHAR NOT NULL, - severity_text VARCHAR, - body VARCHAR NOT NULL, - attributes VARCHAR, - dropped_attributes_count BIGINT, - flags INTEGER, - trace_id VARCHAR(32), - span_id VARCHAR(16), - resource VARCHAR NOT NULL, - instrumentation_scope VARCHAR, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP - ); - """; - - public const string SessionEntitiesDdl = """ - CREATE TABLE IF NOT EXISTS session_entities ( - session.id VARCHAR(128) NOT NULL, - user.id VARCHAR, - start_time TIMESTAMP NOT NULL, - end_time TIMESTAMP, - duration_ms DOUBLE, - trace_count INTEGER NOT NULL, - span_count INTEGER NOT NULL, - error_count INTEGER NOT NULL, - state VARCHAR NOT NULL, - client VARCHAR, - geo VARCHAR, - genai_usage VARCHAR, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP - ); - """; - - public const string SpansDdl = """ - CREATE TABLE IF NOT EXISTS spans ( - span_id VARCHAR(16) NOT NULL, - trace_id VARCHAR(32) NOT NULL, - parent_span_id VARCHAR(16), - trace_state VARCHAR, - name VARCHAR NOT NULL, - kind VARCHAR NOT NULL, - start_time_unix_nano BIGINT NOT NULL, - end_time_unix_nano BIGINT NOT NULL, - attributes VARCHAR, - dropped_attributes_count BIGINT, - events VARCHAR, - dropped_events_count BIGINT, - links VARCHAR, - dropped_links_count BIGINT, - status VARCHAR NOT NULL, - flags INTEGER, - resource VARCHAR NOT NULL, - instrumentation_scope VARCHAR, - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP - ); - """; - -} diff --git a/core/protocol/Enums/Enums.g.cs b/core/protocol/Enums/Enums.g.cs deleted file mode 100644 index efee49a52..000000000 --- a/core/protocol/Enums/Enums.g.cs +++ /dev/null @@ -1,767 +0,0 @@ -// ============================================================================= -// AUTO-GENERATED FILE - DO NOT EDIT -// ============================================================================= -// Source: /Users/ancplua/qyl/core/openapi/openapi.yaml -// Generated: 2026-01-16T09:00:34.9348970+00:00 -// Enumeration types -// ============================================================================= - -#nullable enable - -namespace Qyl.Enums -{ - /// Aggregation functions - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum AggregationFunction - { - [System.Runtime.Serialization.EnumMember(Value = "count")] - Count = 0, - [System.Runtime.Serialization.EnumMember(Value = "sum")] - Sum = 1, - [System.Runtime.Serialization.EnumMember(Value = "avg")] - Avg = 2, - [System.Runtime.Serialization.EnumMember(Value = "min")] - Min = 3, - [System.Runtime.Serialization.EnumMember(Value = "max")] - Max = 4, - [System.Runtime.Serialization.EnumMember(Value = "p50")] - P50 = 5, - [System.Runtime.Serialization.EnumMember(Value = "p90")] - P90 = 6, - [System.Runtime.Serialization.EnumMember(Value = "p95")] - P95 = 7, - [System.Runtime.Serialization.EnumMember(Value = "p99")] - P99 = 8, - [System.Runtime.Serialization.EnumMember(Value = "count_distinct")] - CountDistinct = 9, - } - - /// Aggregation temporality for metrics - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum AggregationTemporality - { - [System.Runtime.Serialization.EnumMember(Value = "0")] - _0 = 0, - [System.Runtime.Serialization.EnumMember(Value = "1")] - _1 = 1, - [System.Runtime.Serialization.EnumMember(Value = "2")] - _2 = 2, - } - - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum ApiVersions - { - [System.Runtime.Serialization.EnumMember(Value = "2024-01-01")] - _20240101 = 0, - [System.Runtime.Serialization.EnumMember(Value = "2024-06-01")] - _20240601 = 1, - [System.Runtime.Serialization.EnumMember(Value = "2025-01-01")] - _20250101 = 2, - } - - /// CI/CD event names - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum CicdEventName - { - [System.Runtime.Serialization.EnumMember(Value = "cicd.pipeline.start")] - CicdPipelineStart = 0, - [System.Runtime.Serialization.EnumMember(Value = "cicd.pipeline.end")] - CicdPipelineEnd = 1, - [System.Runtime.Serialization.EnumMember(Value = "cicd.task.start")] - CicdTaskStart = 2, - [System.Runtime.Serialization.EnumMember(Value = "cicd.task.end")] - CicdTaskEnd = 3, - [System.Runtime.Serialization.EnumMember(Value = "cicd.deployment.start")] - CicdDeploymentStart = 4, - [System.Runtime.Serialization.EnumMember(Value = "cicd.deployment.end")] - CicdDeploymentEnd = 5, - } - - /// CI/CD pipeline status - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum CicdPipelineStatus - { - [System.Runtime.Serialization.EnumMember(Value = "pending")] - Pending = 0, - [System.Runtime.Serialization.EnumMember(Value = "running")] - Running = 1, - [System.Runtime.Serialization.EnumMember(Value = "success")] - Success = 2, - [System.Runtime.Serialization.EnumMember(Value = "failed")] - Failed = 3, - [System.Runtime.Serialization.EnumMember(Value = "cancelled")] - Cancelled = 4, - [System.Runtime.Serialization.EnumMember(Value = "skipped")] - Skipped = 5, - } - - /// CI/CD systems/providers - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum CicdSystem - { - [System.Runtime.Serialization.EnumMember(Value = "github_actions")] - GithubActions = 0, - [System.Runtime.Serialization.EnumMember(Value = "gitlab_ci")] - GitlabCi = 1, - [System.Runtime.Serialization.EnumMember(Value = "jenkins")] - Jenkins = 2, - [System.Runtime.Serialization.EnumMember(Value = "azure_devops")] - AzureDevops = 3, - [System.Runtime.Serialization.EnumMember(Value = "circleci")] - Circleci = 4, - [System.Runtime.Serialization.EnumMember(Value = "travis_ci")] - TravisCi = 5, - [System.Runtime.Serialization.EnumMember(Value = "bitbucket_pipelines")] - BitbucketPipelines = 6, - [System.Runtime.Serialization.EnumMember(Value = "teamcity")] - Teamcity = 7, - [System.Runtime.Serialization.EnumMember(Value = "bamboo")] - Bamboo = 8, - [System.Runtime.Serialization.EnumMember(Value = "drone_ci")] - DroneCi = 9, - [System.Runtime.Serialization.EnumMember(Value = "buildkite")] - Buildkite = 10, - [System.Runtime.Serialization.EnumMember(Value = "tekton")] - Tekton = 11, - [System.Runtime.Serialization.EnumMember(Value = "argocd")] - Argocd = 12, - [System.Runtime.Serialization.EnumMember(Value = "flux")] - Flux = 13, - [System.Runtime.Serialization.EnumMember(Value = "spinnaker")] - Spinnaker = 14, - [System.Runtime.Serialization.EnumMember(Value = "other")] - Other = 15, - } - - /// CI/CD trigger types - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum CicdTriggerType - { - [System.Runtime.Serialization.EnumMember(Value = "push")] - Push = 0, - [System.Runtime.Serialization.EnumMember(Value = "pull_request")] - PullRequest = 1, - [System.Runtime.Serialization.EnumMember(Value = "manual")] - Manual = 2, - [System.Runtime.Serialization.EnumMember(Value = "schedule")] - Schedule = 3, - [System.Runtime.Serialization.EnumMember(Value = "api")] - Api = 4, - [System.Runtime.Serialization.EnumMember(Value = "webhook")] - Webhook = 5, - [System.Runtime.Serialization.EnumMember(Value = "dependency")] - Dependency = 6, - [System.Runtime.Serialization.EnumMember(Value = "tag")] - Tag = 7, - [System.Runtime.Serialization.EnumMember(Value = "release")] - Release = 8, - } - - /// Cloud provider types - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum CloudProvider - { - [System.Runtime.Serialization.EnumMember(Value = "alibaba_cloud")] - AlibabaCloud = 0, - [System.Runtime.Serialization.EnumMember(Value = "aws")] - Aws = 1, - [System.Runtime.Serialization.EnumMember(Value = "azure")] - Azure = 2, - [System.Runtime.Serialization.EnumMember(Value = "gcp")] - Gcp = 3, - [System.Runtime.Serialization.EnumMember(Value = "heroku")] - Heroku = 4, - [System.Runtime.Serialization.EnumMember(Value = "ibm_cloud")] - IbmCloud = 5, - [System.Runtime.Serialization.EnumMember(Value = "tencent_cloud")] - TencentCloud = 6, - } - - /// Data point flags - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum DataPointFlags - { - [System.Runtime.Serialization.EnumMember(Value = "0")] - _0 = 0, - [System.Runtime.Serialization.EnumMember(Value = "1")] - _1 = 1, - } - - /// Deployment environments - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum DeploymentEnvironment - { - [System.Runtime.Serialization.EnumMember(Value = "development")] - Development = 0, - [System.Runtime.Serialization.EnumMember(Value = "testing")] - Testing = 1, - [System.Runtime.Serialization.EnumMember(Value = "staging")] - Staging = 2, - [System.Runtime.Serialization.EnumMember(Value = "production")] - Production = 3, - [System.Runtime.Serialization.EnumMember(Value = "preview")] - Preview = 4, - [System.Runtime.Serialization.EnumMember(Value = "canary")] - Canary = 5, - } - - /// Deployment event names - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum DeploymentEventName - { - [System.Runtime.Serialization.EnumMember(Value = "deployment.started")] - DeploymentStarted = 0, - [System.Runtime.Serialization.EnumMember(Value = "deployment.completed")] - DeploymentCompleted = 1, - [System.Runtime.Serialization.EnumMember(Value = "deployment.failed")] - DeploymentFailed = 2, - [System.Runtime.Serialization.EnumMember(Value = "deployment.rolled_back")] - DeploymentRolledBack = 3, - [System.Runtime.Serialization.EnumMember(Value = "deployment.health_check.passed")] - DeploymentHealthCheckPassed = 4, - [System.Runtime.Serialization.EnumMember(Value = "deployment.health_check.failed")] - DeploymentHealthCheckFailed = 5, - } - - /// Deployment status - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum DeploymentStatus - { - [System.Runtime.Serialization.EnumMember(Value = "pending")] - Pending = 0, - [System.Runtime.Serialization.EnumMember(Value = "in_progress")] - InProgress = 1, - [System.Runtime.Serialization.EnumMember(Value = "success")] - Success = 2, - [System.Runtime.Serialization.EnumMember(Value = "failed")] - Failed = 3, - [System.Runtime.Serialization.EnumMember(Value = "rolled_back")] - RolledBack = 4, - [System.Runtime.Serialization.EnumMember(Value = "cancelled")] - Cancelled = 5, - } - - /// Deployment strategies - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum DeploymentStrategy - { - [System.Runtime.Serialization.EnumMember(Value = "rolling")] - Rolling = 0, - [System.Runtime.Serialization.EnumMember(Value = "blue_green")] - BlueGreen = 1, - [System.Runtime.Serialization.EnumMember(Value = "canary")] - Canary = 2, - [System.Runtime.Serialization.EnumMember(Value = "recreate")] - Recreate = 3, - [System.Runtime.Serialization.EnumMember(Value = "ab_test")] - AbTest = 4, - [System.Runtime.Serialization.EnumMember(Value = "shadow")] - Shadow = 5, - [System.Runtime.Serialization.EnumMember(Value = "feature_flag")] - FeatureFlag = 6, - } - - /// Device types - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum DeviceType - { - [System.Runtime.Serialization.EnumMember(Value = "desktop")] - Desktop = 0, - [System.Runtime.Serialization.EnumMember(Value = "mobile")] - Mobile = 1, - [System.Runtime.Serialization.EnumMember(Value = "tablet")] - Tablet = 2, - [System.Runtime.Serialization.EnumMember(Value = "tv")] - Tv = 3, - [System.Runtime.Serialization.EnumMember(Value = "console")] - Console = 4, - [System.Runtime.Serialization.EnumMember(Value = "wearable")] - Wearable = 5, - [System.Runtime.Serialization.EnumMember(Value = "iot")] - Iot = 6, - [System.Runtime.Serialization.EnumMember(Value = "bot")] - Bot = 7, - [System.Runtime.Serialization.EnumMember(Value = "unknown")] - Unknown = 8, - } - - /// DORA performance levels - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum DoraPerformanceLevel - { - [System.Runtime.Serialization.EnumMember(Value = "elite")] - Elite = 0, - [System.Runtime.Serialization.EnumMember(Value = "high")] - High = 1, - [System.Runtime.Serialization.EnumMember(Value = "medium")] - Medium = 2, - [System.Runtime.Serialization.EnumMember(Value = "low")] - Low = 3, - } - - /// High-level error categories - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum ErrorCategory - { - [System.Runtime.Serialization.EnumMember(Value = "client")] - Client = 0, - [System.Runtime.Serialization.EnumMember(Value = "server")] - Server = 1, - [System.Runtime.Serialization.EnumMember(Value = "network")] - Network = 2, - [System.Runtime.Serialization.EnumMember(Value = "timeout")] - Timeout = 3, - [System.Runtime.Serialization.EnumMember(Value = "validation")] - Validation = 4, - [System.Runtime.Serialization.EnumMember(Value = "authentication")] - Authentication = 5, - [System.Runtime.Serialization.EnumMember(Value = "authorization")] - Authorization = 6, - [System.Runtime.Serialization.EnumMember(Value = "rate_limit")] - RateLimit = 7, - [System.Runtime.Serialization.EnumMember(Value = "not_found")] - NotFound = 8, - [System.Runtime.Serialization.EnumMember(Value = "conflict")] - Conflict = 9, - [System.Runtime.Serialization.EnumMember(Value = "internal")] - Internal = 10, - [System.Runtime.Serialization.EnumMember(Value = "external")] - External = 11, - [System.Runtime.Serialization.EnumMember(Value = "database")] - Database = 12, - [System.Runtime.Serialization.EnumMember(Value = "configuration")] - Configuration = 13, - [System.Runtime.Serialization.EnumMember(Value = "unknown")] - Unknown = 14, - } - - /// Error tracking status - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum ErrorStatus - { - [System.Runtime.Serialization.EnumMember(Value = "new")] - New = 0, - [System.Runtime.Serialization.EnumMember(Value = "acknowledged")] - Acknowledged = 1, - [System.Runtime.Serialization.EnumMember(Value = "in_progress")] - InProgress = 2, - [System.Runtime.Serialization.EnumMember(Value = "resolved")] - Resolved = 3, - [System.Runtime.Serialization.EnumMember(Value = "ignored")] - Ignored = 4, - [System.Runtime.Serialization.EnumMember(Value = "regressed")] - Regressed = 5, - [System.Runtime.Serialization.EnumMember(Value = "wont_fix")] - WontFix = 6, - } - - /// Error trend - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum ErrorTrend - { - [System.Runtime.Serialization.EnumMember(Value = "increasing")] - Increasing = 0, - [System.Runtime.Serialization.EnumMember(Value = "decreasing")] - Decreasing = 1, - [System.Runtime.Serialization.EnumMember(Value = "stable")] - Stable = 2, - [System.Runtime.Serialization.EnumMember(Value = "spike")] - Spike = 3, - } - - /// Exception status - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum ExceptionStatus - { - [System.Runtime.Serialization.EnumMember(Value = "new")] - New = 0, - [System.Runtime.Serialization.EnumMember(Value = "investigating")] - Investigating = 1, - [System.Runtime.Serialization.EnumMember(Value = "in_progress")] - InProgress = 2, - [System.Runtime.Serialization.EnumMember(Value = "resolved")] - Resolved = 3, - [System.Runtime.Serialization.EnumMember(Value = "ignored")] - Ignored = 4, - [System.Runtime.Serialization.EnumMember(Value = "regressed")] - Regressed = 5, - } - - /// Exception trend - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum ExceptionTrend - { - [System.Runtime.Serialization.EnumMember(Value = "up")] - Up = 0, - [System.Runtime.Serialization.EnumMember(Value = "down")] - Down = 1, - [System.Runtime.Serialization.EnumMember(Value = "stable")] - Stable = 2, - } - - /// Filter operators - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum FilterOperator - { - [System.Runtime.Serialization.EnumMember(Value = "eq")] - Eq = 0, - [System.Runtime.Serialization.EnumMember(Value = "neq")] - Neq = 1, - [System.Runtime.Serialization.EnumMember(Value = "contains")] - Contains = 2, - [System.Runtime.Serialization.EnumMember(Value = "starts_with")] - StartsWith = 3, - [System.Runtime.Serialization.EnumMember(Value = "ends_with")] - EndsWith = 4, - [System.Runtime.Serialization.EnumMember(Value = "regex")] - Regex = 5, - [System.Runtime.Serialization.EnumMember(Value = "gt")] - Gt = 6, - [System.Runtime.Serialization.EnumMember(Value = "gte")] - Gte = 7, - [System.Runtime.Serialization.EnumMember(Value = "lt")] - Lt = 8, - [System.Runtime.Serialization.EnumMember(Value = "lte")] - Lte = 9, - [System.Runtime.Serialization.EnumMember(Value = "in")] - In = 10, - [System.Runtime.Serialization.EnumMember(Value = "not_in")] - NotIn = 11, - [System.Runtime.Serialization.EnumMember(Value = "exists")] - Exists = 12, - [System.Runtime.Serialization.EnumMember(Value = "not_exists")] - NotExists = 13, - } - - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum HealthStatus - { - [System.Runtime.Serialization.EnumMember(Value = "healthy")] - Healthy = 0, - [System.Runtime.Serialization.EnumMember(Value = "degraded")] - Degraded = 1, - [System.Runtime.Serialization.EnumMember(Value = "unhealthy")] - Unhealthy = 2, - } - - /// Host architecture types - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum HostArch - { - [System.Runtime.Serialization.EnumMember(Value = "amd64")] - Amd64 = 0, - [System.Runtime.Serialization.EnumMember(Value = "arm32")] - Arm32 = 1, - [System.Runtime.Serialization.EnumMember(Value = "arm64")] - Arm64 = 2, - [System.Runtime.Serialization.EnumMember(Value = "ia64")] - Ia64 = 3, - [System.Runtime.Serialization.EnumMember(Value = "ppc32")] - Ppc32 = 4, - [System.Runtime.Serialization.EnumMember(Value = "ppc64")] - Ppc64 = 5, - [System.Runtime.Serialization.EnumMember(Value = "s390x")] - S390x = 6, - [System.Runtime.Serialization.EnumMember(Value = "x86")] - X86 = 7, - } - - /// Log ordering options - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum LogOrderBy - { - [System.Runtime.Serialization.EnumMember(Value = "timestamp_asc")] - TimestampAsc = 0, - [System.Runtime.Serialization.EnumMember(Value = "timestamp_desc")] - TimestampDesc = 1, - [System.Runtime.Serialization.EnumMember(Value = "severity_asc")] - SeverityAsc = 2, - [System.Runtime.Serialization.EnumMember(Value = "severity_desc")] - SeverityDesc = 3, - } - - /// Log pattern trend - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum LogPatternTrend - { - [System.Runtime.Serialization.EnumMember(Value = "increasing")] - Increasing = 0, - [System.Runtime.Serialization.EnumMember(Value = "decreasing")] - Decreasing = 1, - [System.Runtime.Serialization.EnumMember(Value = "stable")] - Stable = 2, - [System.Runtime.Serialization.EnumMember(Value = "new")] - New = 3, - [System.Runtime.Serialization.EnumMember(Value = "spike")] - Spike = 4, - } - - /// Metric data type - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum MetricType - { - [System.Runtime.Serialization.EnumMember(Value = "gauge")] - Gauge = 0, - [System.Runtime.Serialization.EnumMember(Value = "sum")] - Sum = 1, - [System.Runtime.Serialization.EnumMember(Value = "histogram")] - Histogram = 2, - [System.Runtime.Serialization.EnumMember(Value = "exponential_histogram")] - ExponentialHistogram = 3, - [System.Runtime.Serialization.EnumMember(Value = "summary")] - Summary = 4, - } - - /// Operating system types - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum OsType - { - [System.Runtime.Serialization.EnumMember(Value = "windows")] - Windows = 0, - [System.Runtime.Serialization.EnumMember(Value = "linux")] - Linux = 1, - [System.Runtime.Serialization.EnumMember(Value = "darwin")] - Darwin = 2, - [System.Runtime.Serialization.EnumMember(Value = "freebsd")] - Freebsd = 3, - [System.Runtime.Serialization.EnumMember(Value = "netbsd")] - Netbsd = 4, - [System.Runtime.Serialization.EnumMember(Value = "openbsd")] - Openbsd = 5, - [System.Runtime.Serialization.EnumMember(Value = "dragonflybsd")] - Dragonflybsd = 6, - [System.Runtime.Serialization.EnumMember(Value = "hpux")] - Hpux = 7, - [System.Runtime.Serialization.EnumMember(Value = "aix")] - Aix = 8, - [System.Runtime.Serialization.EnumMember(Value = "solaris")] - Solaris = 9, - [System.Runtime.Serialization.EnumMember(Value = "z_os")] - ZOs = 10, - } - - /// Session states - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum SessionState - { - [System.Runtime.Serialization.EnumMember(Value = "active")] - Active = 0, - [System.Runtime.Serialization.EnumMember(Value = "idle")] - Idle = 1, - [System.Runtime.Serialization.EnumMember(Value = "ended")] - Ended = 2, - [System.Runtime.Serialization.EnumMember(Value = "timed_out")] - TimedOut = 3, - [System.Runtime.Serialization.EnumMember(Value = "invalidated")] - Invalidated = 4, - } - - /// Log severity number following OTel specification (1-24) - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum SeverityNumber - { - [System.Runtime.Serialization.EnumMember(Value = "0")] - _0 = 0, - [System.Runtime.Serialization.EnumMember(Value = "1")] - _1 = 1, - [System.Runtime.Serialization.EnumMember(Value = "2")] - _2 = 2, - [System.Runtime.Serialization.EnumMember(Value = "3")] - _3 = 3, - [System.Runtime.Serialization.EnumMember(Value = "4")] - _4 = 4, - [System.Runtime.Serialization.EnumMember(Value = "5")] - _5 = 5, - [System.Runtime.Serialization.EnumMember(Value = "6")] - _6 = 6, - [System.Runtime.Serialization.EnumMember(Value = "7")] - _7 = 7, - [System.Runtime.Serialization.EnumMember(Value = "8")] - _8 = 8, - [System.Runtime.Serialization.EnumMember(Value = "9")] - _9 = 9, - [System.Runtime.Serialization.EnumMember(Value = "10")] - _10 = 10, - [System.Runtime.Serialization.EnumMember(Value = "11")] - _11 = 11, - [System.Runtime.Serialization.EnumMember(Value = "12")] - _12 = 12, - [System.Runtime.Serialization.EnumMember(Value = "13")] - _13 = 13, - [System.Runtime.Serialization.EnumMember(Value = "14")] - _14 = 14, - [System.Runtime.Serialization.EnumMember(Value = "15")] - _15 = 15, - [System.Runtime.Serialization.EnumMember(Value = "16")] - _16 = 16, - [System.Runtime.Serialization.EnumMember(Value = "17")] - _17 = 17, - [System.Runtime.Serialization.EnumMember(Value = "18")] - _18 = 18, - [System.Runtime.Serialization.EnumMember(Value = "19")] - _19 = 19, - [System.Runtime.Serialization.EnumMember(Value = "20")] - _20 = 20, - [System.Runtime.Serialization.EnumMember(Value = "21")] - _21 = 21, - [System.Runtime.Serialization.EnumMember(Value = "22")] - _22 = 22, - [System.Runtime.Serialization.EnumMember(Value = "23")] - _23 = 23, - [System.Runtime.Serialization.EnumMember(Value = "24")] - _24 = 24, - } - - /// Log severity text (human-readable) - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum SeverityText - { - [System.Runtime.Serialization.EnumMember(Value = "TRACE")] - TRACE = 0, - [System.Runtime.Serialization.EnumMember(Value = "DEBUG")] - DEBUG = 1, - [System.Runtime.Serialization.EnumMember(Value = "INFO")] - INFO = 2, - [System.Runtime.Serialization.EnumMember(Value = "WARN")] - WARN = 3, - [System.Runtime.Serialization.EnumMember(Value = "ERROR")] - ERROR = 4, - [System.Runtime.Serialization.EnumMember(Value = "FATAL")] - FATAL = 5, - } - - /// Span kind describing the relationship between spans - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum SpanKind - { - [System.Runtime.Serialization.EnumMember(Value = "0")] - _0 = 0, - [System.Runtime.Serialization.EnumMember(Value = "1")] - _1 = 1, - [System.Runtime.Serialization.EnumMember(Value = "2")] - _2 = 2, - [System.Runtime.Serialization.EnumMember(Value = "3")] - _3 = 3, - [System.Runtime.Serialization.EnumMember(Value = "4")] - _4 = 4, - [System.Runtime.Serialization.EnumMember(Value = "5")] - _5 = 5, - } - - /// Span status code - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum SpanStatusCode - { - [System.Runtime.Serialization.EnumMember(Value = "0")] - _0 = 0, - [System.Runtime.Serialization.EnumMember(Value = "1")] - _1 = 1, - [System.Runtime.Serialization.EnumMember(Value = "2")] - _2 = 2, - } - - /// Stream event types - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum StreamEventType - { - [System.Runtime.Serialization.EnumMember(Value = "traces")] - Traces = 0, - [System.Runtime.Serialization.EnumMember(Value = "spans")] - Spans = 1, - [System.Runtime.Serialization.EnumMember(Value = "logs")] - Logs = 2, - [System.Runtime.Serialization.EnumMember(Value = "metrics")] - Metrics = 3, - [System.Runtime.Serialization.EnumMember(Value = "exceptions")] - Exceptions = 4, - [System.Runtime.Serialization.EnumMember(Value = "deployments")] - Deployments = 5, - [System.Runtime.Serialization.EnumMember(Value = "all")] - All = 6, - } - - /// Telemetry SDK language - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum TelemetrySdkLanguage - { - [System.Runtime.Serialization.EnumMember(Value = "cpp")] - Cpp = 0, - [System.Runtime.Serialization.EnumMember(Value = "dotnet")] - Dotnet = 1, - [System.Runtime.Serialization.EnumMember(Value = "erlang")] - Erlang = 2, - [System.Runtime.Serialization.EnumMember(Value = "go")] - Go = 3, - [System.Runtime.Serialization.EnumMember(Value = "java")] - Java = 4, - [System.Runtime.Serialization.EnumMember(Value = "nodejs")] - Nodejs = 5, - [System.Runtime.Serialization.EnumMember(Value = "php")] - Php = 6, - [System.Runtime.Serialization.EnumMember(Value = "python")] - Python = 7, - [System.Runtime.Serialization.EnumMember(Value = "ruby")] - Ruby = 8, - [System.Runtime.Serialization.EnumMember(Value = "rust")] - Rust = 9, - [System.Runtime.Serialization.EnumMember(Value = "swift")] - Swift = 10, - [System.Runtime.Serialization.EnumMember(Value = "webjs")] - Webjs = 11, - } - - /// Temporal relationship between errors - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum TemporalRelationship - { - [System.Runtime.Serialization.EnumMember(Value = "concurrent")] - Concurrent = 0, - [System.Runtime.Serialization.EnumMember(Value = "precedes")] - Precedes = 1, - [System.Runtime.Serialization.EnumMember(Value = "follows")] - Follows = 2, - [System.Runtime.Serialization.EnumMember(Value = "unrelated")] - Unrelated = 3, - } - - /// Time bucket size for aggregations - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum TimeBucket - { - [System.Runtime.Serialization.EnumMember(Value = "1m")] - _1m = 0, - [System.Runtime.Serialization.EnumMember(Value = "5m")] - _5m = 1, - [System.Runtime.Serialization.EnumMember(Value = "15m")] - _15m = 2, - [System.Runtime.Serialization.EnumMember(Value = "1h")] - _1h = 3, - [System.Runtime.Serialization.EnumMember(Value = "1d")] - _1d = 4, - [System.Runtime.Serialization.EnumMember(Value = "1w")] - _1w = 5, - [System.Runtime.Serialization.EnumMember(Value = "auto")] - Auto = 6, - } - - /// WebSocket message types - [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] - public enum WebSocketMessageType - { - [System.Runtime.Serialization.EnumMember(Value = "subscribe")] - Subscribe = 0, - [System.Runtime.Serialization.EnumMember(Value = "unsubscribe")] - Unsubscribe = 1, - [System.Runtime.Serialization.EnumMember(Value = "data")] - Data = 2, - [System.Runtime.Serialization.EnumMember(Value = "error")] - Error = 3, - [System.Runtime.Serialization.EnumMember(Value = "ack")] - Ack = 4, - [System.Runtime.Serialization.EnumMember(Value = "ping")] - Ping = 5, - [System.Runtime.Serialization.EnumMember(Value = "pong")] - Pong = 6, - } - -} diff --git a/core/protocol/Models/Types.g.cs b/core/protocol/Models/Types.g.cs deleted file mode 100644 index 4522bb176..000000000 --- a/core/protocol/Models/Types.g.cs +++ /dev/null @@ -1,2573 +0,0 @@ -// ============================================================================= -// AUTO-GENERATED FILE - DO NOT EDIT -// ============================================================================= -// Source: /Users/ancplua/qyl/core/openapi/openapi.yaml -// Generated: 2026-01-16T09:00:34.9370760+00:00 -// Models for Qyl -// ============================================================================= - -#nullable enable - -using System; -using System.Collections.Generic; -using System.Text.Json.Serialization; - -namespace Qyl; - -/// Key-value attribute pair following OTel conventions -public sealed record Attribute -{ - /// Attribute key (dot-separated namespace) - [JsonPropertyName("key")] - public required string Key { get; init; } - - /// Attribute value - [JsonPropertyName("value")] - public required Qyl.Common.AttributeValue Value { get; init; } - -} - -/// Attribute filter -public sealed record AttributeFilter -{ - /// Attribute key - [JsonPropertyName("key")] - public required string Key { get; init; } - - /// Filter operator - [JsonPropertyName("operator")] - public required Qyl.Domains.Observe.Log.FilterOperator Operator { get; init; } - - /// Filter value - [JsonPropertyName("value")] - public required string Value { get; init; } - -} - -/// Precise source code location for debugging and tracing -public sealed record CodeLocation -{ - /// Source file path - [JsonPropertyName("filepath")] - public required string Filepath { get; init; } - - /// Line number (1-indexed) - [JsonPropertyName("line_number")] - public required int LineNumber { get; init; } - - /// Column number (1-indexed) - [JsonPropertyName("column_number")] - public int? ColumnNumber { get; init; } - - /// Function/method name - [JsonPropertyName("function_name")] - public string? FunctionName { get; init; } - - /// Class/type name - [JsonPropertyName("class_name")] - public string? ClassName { get; init; } - - /// Namespace/module - [JsonPropertyName("namespace")] - public string? Namespace { get; init; } - -} - -/// Conflict - resource state conflict (409) -public sealed record ConflictError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - - /// The conflicting resource ID - [JsonPropertyName("conflicting_resource")] - public string? ConflictingResource { get; init; } - -} - -/// Correlated error -public sealed record CorrelatedError -{ - /// Error ID - [JsonPropertyName("error_id")] - public required string ErrorId { get; init; } - - /// Error type - [JsonPropertyName("error_type")] - public required string ErrorType { get; init; } - - /// Correlation strength - [JsonPropertyName("correlation_strength")] - public required Qyl.Common.Ratio CorrelationStrength { get; init; } - - /// Temporal relationship - [JsonPropertyName("temporal_relationship")] - public required Qyl.Domains.Observe.Error.TemporalRelationship TemporalRelationship { get; init; } - -} - -/// Base data point with common fields -public sealed record DataPointBase -{ - /// Start timestamp in nanoseconds since epoch - [JsonPropertyName("start_time_unix_nano")] - public required long StartTimeUnixNano { get; init; } - - /// End timestamp in nanoseconds since epoch - [JsonPropertyName("time_unix_nano")] - public required long TimeUnixNano { get; init; } - - /// Data point attributes - [JsonPropertyName("attributes")] - public IReadOnlyList? Attributes { get; init; } - - /// Data point flags - [JsonPropertyName("flags")] - public Qyl.OTel.Enums.DataPointFlags? Flags { get; init; } - -} - -/// Deployment creation request -public sealed record DeploymentCreate -{ - /// Service name - [JsonPropertyName("service_name")] - public required string ServiceName { get; init; } - - /// Service version - [JsonPropertyName("service_version")] - public required Qyl.Common.SemVer ServiceVersion { get; init; } - - /// Environment - [JsonPropertyName("environment")] - public required Qyl.Domains.Ops.Deployment.DeploymentEnvironment Environment { get; init; } - - /// Strategy - [JsonPropertyName("strategy")] - public required Qyl.Domains.Ops.Deployment.DeploymentStrategy Strategy { get; init; } - - /// Deployed by - [JsonPropertyName("deployed_by")] - public string? DeployedBy { get; init; } - - /// Git commit SHA - [JsonPropertyName("git_commit")] - public string? GitCommit { get; init; } - - /// Git branch - [JsonPropertyName("git_branch")] - public string? GitBranch { get; init; } - -} - -/// Complete deployment record -public sealed record DeploymentEntity -{ - /// Deployment ID - [JsonPropertyName("deployment.id")] - public required string DeploymentId { get; init; } - - /// Service name - [JsonPropertyName("service.name")] - public required string ServiceName { get; init; } - - /// Service version - [JsonPropertyName("service.version")] - public required Qyl.Common.SemVer ServiceVersion { get; init; } - - /// Environment - [JsonPropertyName("environment")] - public required Qyl.Domains.Ops.Deployment.DeploymentEnvironment Environment { get; init; } - - /// Status - [JsonPropertyName("status")] - public required Qyl.Domains.Ops.Deployment.DeploymentStatus Status { get; init; } - - /// Strategy - [JsonPropertyName("strategy")] - public required Qyl.Domains.Ops.Deployment.DeploymentStrategy Strategy { get; init; } - - /// Start time - [JsonPropertyName("start_time")] - public required DateTimeOffset StartTime { get; init; } - - /// End time - [JsonPropertyName("end_time")] - public DateTimeOffset? EndTime { get; init; } - - /// Duration in seconds - [JsonPropertyName("duration_s")] - public Qyl.Common.DurationS? DurationS { get; init; } - - /// Deployed by (user/system) - [JsonPropertyName("deployed_by")] - public string? DeployedBy { get; init; } - - /// Git commit SHA - [JsonPropertyName("git_commit")] - public string? GitCommit { get; init; } - - /// Git branch - [JsonPropertyName("git_branch")] - public string? GitBranch { get; init; } - - /// Previous version - [JsonPropertyName("previous_version")] - public Qyl.Common.SemVer? PreviousVersion { get; init; } - - /// Rollback target (if rolled back) - [JsonPropertyName("rollback_target")] - public string? RollbackTarget { get; init; } - - /// Replica count - [JsonPropertyName("replica_count")] - public int? ReplicaCount { get; init; } - - /// Healthy replica count - [JsonPropertyName("healthy_replicas")] - public int? HealthyReplicas { get; init; } - - /// Error message (if failed) - [JsonPropertyName("error_message")] - public string? ErrorMessage { get; init; } - -} - -/// Deployment lifecycle event -public sealed record DeploymentEvent -{ - /// Event name - [JsonPropertyName("event.name")] - public required Qyl.Domains.Ops.Deployment.DeploymentEventName EventName { get; init; } - - /// Deployment ID - [JsonPropertyName("deployment.id")] - public required string DeploymentId { get; init; } - - /// Service name - [JsonPropertyName("service.name")] - public required string ServiceName { get; init; } - - /// Environment - [JsonPropertyName("deployment.environment.name")] - public required Qyl.Domains.Ops.Deployment.DeploymentEnvironment DeploymentEnvironmentName { get; init; } - - /// Status - [JsonPropertyName("status")] - public required Qyl.Domains.Ops.Deployment.DeploymentStatus Status { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Deployment stream event -public sealed record DeploymentStreamEvent -{ - /// Event type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Deployment event data - [JsonPropertyName("data")] - public required Qyl.Domains.Ops.Deployment.DeploymentEvent Data { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Deployment update request -public sealed record DeploymentUpdate -{ - /// New status - [JsonPropertyName("status")] - public Qyl.Domains.Ops.Deployment.DeploymentStatus? Status { get; init; } - - /// Healthy replicas - [JsonPropertyName("healthy_replicas")] - public int? HealthyReplicas { get; init; } - - /// Error message - [JsonPropertyName("error_message")] - public string? ErrorMessage { get; init; } - -} - -/// DORA metrics response -public sealed record DoraMetrics -{ - /// Deployment frequency (per day) - [JsonPropertyName("deployment_frequency")] - public required double DeploymentFrequency { get; init; } - - /// Lead time for changes (hours) - [JsonPropertyName("lead_time_hours")] - public required double LeadTimeHours { get; init; } - - /// Change failure rate - [JsonPropertyName("change_failure_rate")] - public required Qyl.Common.Ratio ChangeFailureRate { get; init; } - - /// Mean time to recovery (hours) - [JsonPropertyName("mttr_hours")] - public required double MttrHours { get; init; } - - /// Performance level - [JsonPropertyName("performance_level")] - public required DoraPerformanceLevel PerformanceLevel { get; init; } - -} - -/// Enriched exception with parsed stack trace -public sealed record EnrichedException -{ - /// Exception type/class name - [JsonPropertyName("exception_type")] - public required string ExceptionType { get; init; } - - /// Exception message - [JsonPropertyName("message")] - public required string Message { get; init; } - - /// Parsed stack trace - [JsonPropertyName("stack_trace")] - public Qyl.Domains.AI.Code.StackTrace? StackTrace { get; init; } - - /// Exception cause/inner exception - [JsonPropertyName("cause")] - public Qyl.Domains.Observe.Exceptions.EnrichedException? Cause { get; init; } - - /// Additional exception data - [JsonPropertyName("data")] - public IReadOnlyList? Data { get; init; } - - /// Exception fingerprint (for grouping) - [JsonPropertyName("fingerprint")] - public string? Fingerprint { get; init; } - - /// First occurrence timestamp - [JsonPropertyName("first_seen")] - public DateTimeOffset? FirstSeen { get; init; } - - /// Last occurrence timestamp - [JsonPropertyName("last_seen")] - public DateTimeOffset? LastSeen { get; init; } - - /// Occurrence count - [JsonPropertyName("occurrence_count")] - public Qyl.Common.Count? OccurrenceCount { get; init; } - - /// Affected users count - [JsonPropertyName("affected_users")] - public Qyl.Common.Count? AffectedUsers { get; init; } - - /// Status - [JsonPropertyName("status")] - public Qyl.Domains.Observe.Exceptions.ExceptionStatus? Status { get; init; } - -} - -/// Error stats by category -public sealed record ErrorCategoryStats -{ - /// Category - [JsonPropertyName("category")] - public required Qyl.Domains.Observe.Error.ErrorCategory Category { get; init; } - - /// Count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage of total - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - -} - -/// Error correlation result -public sealed record ErrorCorrelation -{ - /// Error ID - [JsonPropertyName("error_id")] - public required string ErrorId { get; init; } - - /// Correlated errors - [JsonPropertyName("correlated_errors")] - public required IReadOnlyList CorrelatedErrors { get; init; } - - /// Potential root cause - [JsonPropertyName("root_cause")] - public string? RootCause { get; init; } - - /// Common attributes - [JsonPropertyName("common_attributes")] - public IReadOnlyList? CommonAttributes { get; init; } - -} - -/// Error entity for tracking and analysis -public sealed record ErrorEntity -{ - /// Error ID - [JsonPropertyName("error_id")] - public required string ErrorId { get; init; } - - /// Error type (class name or code) - [JsonPropertyName("error.type")] - public required string ErrorType { get; init; } - - /// Error message - [JsonPropertyName("message")] - public required string Message { get; init; } - - /// Error category - [JsonPropertyName("category")] - public required Qyl.Domains.Observe.Error.ErrorCategory Category { get; init; } - - /// Fingerprint for grouping - [JsonPropertyName("fingerprint")] - public required string Fingerprint { get; init; } - - /// First occurrence - [JsonPropertyName("first_seen")] - public required DateTimeOffset FirstSeen { get; init; } - - /// Last occurrence - [JsonPropertyName("last_seen")] - public required DateTimeOffset LastSeen { get; init; } - - /// Occurrence count - [JsonPropertyName("occurrence_count")] - public required Qyl.Common.Count OccurrenceCount { get; init; } - - /// Affected users count - [JsonPropertyName("affected_users")] - public Qyl.Common.Count? AffectedUsers { get; init; } - - /// Affected services - [JsonPropertyName("affected_services")] - public IReadOnlyList? AffectedServices { get; init; } - - /// Status - [JsonPropertyName("status")] - public required Qyl.Domains.Observe.Error.ErrorStatus Status { get; init; } - - /// Assigned to - [JsonPropertyName("assigned_to")] - public string? AssignedTo { get; init; } - - /// Issue tracker URL - [JsonPropertyName("issue_url")] - public Qyl.Common.UrlString? IssueUrl { get; init; } - - /// Sample trace IDs - [JsonPropertyName("sample_traces")] - public IReadOnlyList? SampleTraces { get; init; } - -} - -/// Error stats by service -public sealed record ErrorServiceStats -{ - /// Service name - [JsonPropertyName("service_name")] - public required string ServiceName { get; init; } - - /// Error count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Error rate - [JsonPropertyName("error_rate")] - public required Qyl.Common.Ratio ErrorRate { get; init; } - - /// Top error type - [JsonPropertyName("top_error_type")] - public required string TopErrorType { get; init; } - -} - -/// Error statistics -public sealed record ErrorStats -{ - /// Total error count - [JsonPropertyName("total_count")] - public required Qyl.Common.Count TotalCount { get; init; } - - /// Unique error types - [JsonPropertyName("unique_types")] - public required int UniqueTypes { get; init; } - - /// Error rate - [JsonPropertyName("error_rate")] - public required Qyl.Common.Ratio ErrorRate { get; init; } - - /// Errors by category - [JsonPropertyName("by_category")] - public required IReadOnlyList ByCategory { get; init; } - - /// Errors by service - [JsonPropertyName("by_service")] - public IReadOnlyList? ByService { get; init; } - - /// Top errors - [JsonPropertyName("top_errors")] - public required IReadOnlyList TopErrors { get; init; } - - /// Trend - [JsonPropertyName("trend")] - public required Qyl.Domains.Observe.Error.ErrorTrend Trend { get; init; } - -} - -/// Error stats by type -public sealed record ErrorTypeStats -{ - /// Error type - [JsonPropertyName("error_type")] - public required string ErrorType { get; init; } - - /// Count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage of total - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - - /// Affected users - [JsonPropertyName("affected_users")] - public Qyl.Common.Count? AffectedUsers { get; init; } - - /// Status - [JsonPropertyName("status")] - public required Qyl.Domains.Observe.Error.ErrorStatus Status { get; init; } - -} - -/// Error update request -public sealed record ErrorUpdate -{ - /// New status - [JsonPropertyName("status")] - public Qyl.Domains.Observe.Error.ErrorStatus? Status { get; init; } - - /// Assignee - [JsonPropertyName("assigned_to")] - public string? AssignedTo { get; init; } - - /// Issue URL - [JsonPropertyName("issue_url")] - public Qyl.Common.UrlString? IssueUrl { get; init; } - -} - -/// Exception event following OTel spec -public sealed record ExceptionEvent -{ - /// Event name (always 'exception') - [JsonPropertyName("event.name")] - public required string EventName { get; init; } - - /// Exception type/class name - [JsonPropertyName("exception.type")] - public required string ExceptionType { get; init; } - - /// Exception message - [JsonPropertyName("exception.message")] - public required string ExceptionMessage { get; init; } - - /// Exception stacktrace - [JsonPropertyName("exception.stacktrace")] - public string? ExceptionStacktrace { get; init; } - - /// Whether the exception escaped - [JsonPropertyName("exception.escaped")] - public required bool ExceptionEscaped { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - - /// Associated trace ID - [JsonPropertyName("trace_id")] - public Qyl.Common.TraceId? TraceId { get; init; } - - /// Associated span ID - [JsonPropertyName("span_id")] - public Qyl.Common.SpanId? SpanId { get; init; } - -} - -/// Exception stats by service -public sealed record ExceptionServiceStats -{ - /// Service name - [JsonPropertyName("service_name")] - public required string ServiceName { get; init; } - - /// Exception count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Exception rate (per minute) - [JsonPropertyName("rate_per_minute")] - public required double RatePerMinute { get; init; } - -} - -/// Exception statistics -public sealed record ExceptionStats -{ - /// Total exception count - [JsonPropertyName("total_count")] - public required Qyl.Common.Count TotalCount { get; init; } - - /// Unique exception types - [JsonPropertyName("unique_types")] - public required int UniqueTypes { get; init; } - - /// Exceptions by type - [JsonPropertyName("by_type")] - public required IReadOnlyList ByType { get; init; } - - /// Most affected services - [JsonPropertyName("by_service")] - public IReadOnlyList? ByService { get; init; } - - /// Exception trend (up/down/stable) - [JsonPropertyName("trend")] - public Qyl.Domains.Observe.Exceptions.ExceptionTrend? Trend { get; init; } - -} - -/// Exception stream event -public sealed record ExceptionStreamEvent -{ - /// Event type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Exception data - [JsonPropertyName("data")] - public required Qyl.Domains.Observe.Exceptions.ExceptionEvent Data { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Exception stats by type -public sealed record ExceptionTypeStats -{ - /// Exception type - [JsonPropertyName("exception_type")] - public required string ExceptionType { get; init; } - - /// Count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage of total - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - - /// Status - [JsonPropertyName("status")] - public required Qyl.Domains.Observe.Exceptions.ExceptionStatus Status { get; init; } - -} - -/// Exemplar - sample trace linked to metric -public sealed record Exemplar -{ - /// Timestamp in nanoseconds since epoch - [JsonPropertyName("time_unix_nano")] - public required long TimeUnixNano { get; init; } - - /// Value as integer - [JsonPropertyName("as_int")] - public long? AsInt { get; init; } - - /// Value as double - [JsonPropertyName("as_double")] - public double? AsDouble { get; init; } - - /// Span ID of the exemplar - [JsonPropertyName("span_id")] - public Qyl.Common.SpanId? SpanId { get; init; } - - /// Trace ID of the exemplar - [JsonPropertyName("trace_id")] - public Qyl.Common.TraceId? TraceId { get; init; } - - /// Filtered attributes - [JsonPropertyName("filtered_attributes")] - public IReadOnlyList? FilteredAttributes { get; init; } - -} - -/// Exponential histogram buckets -public sealed record ExponentialBuckets -{ - /// Offset of the first bucket - [JsonPropertyName("offset")] - public required int Offset { get; init; } - - /// Bucket counts - [JsonPropertyName("bucket_counts")] - public required IReadOnlyList BucketCounts { get; init; } - -} - -/// Exponential histogram metric - distribution with exponential bucket boundaries -public sealed record ExponentialHistogramData -{ - /// Discriminator identifying this as exponential histogram metric data - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Exponential histogram data points - [JsonPropertyName("data_points")] - public required IReadOnlyList DataPoints { get; init; } - - /// Aggregation temporality - [JsonPropertyName("aggregation_temporality")] - public required Qyl.OTel.Enums.AggregationTemporality AggregationTemporality { get; init; } - -} - -/// Exponential histogram data point -public sealed record ExponentialHistogramDataPoint -{ - /// Number of values - [JsonPropertyName("count")] - public required long Count { get; init; } - - /// Sum of all values - [JsonPropertyName("sum")] - public double? Sum { get; init; } - - /// Scale factor for bucket boundaries - [JsonPropertyName("scale")] - public required int Scale { get; init; } - - /// Zero count - [JsonPropertyName("zero_count")] - public required long ZeroCount { get; init; } - - /// Zero threshold - [JsonPropertyName("zero_threshold")] - public double? ZeroThreshold { get; init; } - - /// Positive bucket counts - [JsonPropertyName("positive")] - public required Qyl.OTel.Metrics.ExponentialBuckets Positive { get; init; } - - /// Negative bucket counts - [JsonPropertyName("negative")] - public required Qyl.OTel.Metrics.ExponentialBuckets Negative { get; init; } - - /// Minimum value - [JsonPropertyName("min")] - public double? Min { get; init; } - - /// Maximum value - [JsonPropertyName("max")] - public double? Max { get; init; } - - /// Exemplars for the data point - [JsonPropertyName("exemplars")] - public IReadOnlyList? Exemplars { get; init; } - -} - -/// Forbidden - insufficient permissions (403) -public sealed record ForbiddenError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - - /// Required permission that is missing - [JsonPropertyName("required_permission")] - public string? RequiredPermission { get; init; } - -} - -/// Gauge metric - instantaneous value at a point in time -public sealed record GaugeData -{ - /// Discriminator identifying this as gauge metric data - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Gauge data points - [JsonPropertyName("data_points")] - public required IReadOnlyList DataPoints { get; init; } - -} - -/// Health check response -public sealed record HealthResponse -{ - /// Service status - [JsonPropertyName("status")] - public required HealthStatus Status { get; init; } - - /// Service version - [JsonPropertyName("version")] - public required Qyl.Common.SemVer Version { get; init; } - - /// Uptime in seconds - [JsonPropertyName("uptime_seconds")] - public required long UptimeSeconds { get; init; } - - /// Component health - [JsonPropertyName("components")] - public object? Components { get; init; } - -} - -/// Heartbeat event for connection keep-alive -public sealed record HeartbeatEvent -{ - /// Event type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Server timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Histogram metric - distribution of values in buckets -public sealed record HistogramData -{ - /// Discriminator identifying this as histogram metric data - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Histogram data points - [JsonPropertyName("data_points")] - public required IReadOnlyList DataPoints { get; init; } - - /// Aggregation temporality - [JsonPropertyName("aggregation_temporality")] - public required Qyl.OTel.Enums.AggregationTemporality AggregationTemporality { get; init; } - -} - -/// Histogram data point -public sealed record HistogramDataPoint -{ - /// Number of values in the histogram - [JsonPropertyName("count")] - public required long Count { get; init; } - - /// Sum of all values - [JsonPropertyName("sum")] - public double? Sum { get; init; } - - /// Bucket counts - [JsonPropertyName("bucket_counts")] - public required IReadOnlyList BucketCounts { get; init; } - - /// Explicit bucket boundaries - [JsonPropertyName("explicit_bounds")] - public required IReadOnlyList ExplicitBounds { get; init; } - - /// Minimum value - [JsonPropertyName("min")] - public double? Min { get; init; } - - /// Maximum value - [JsonPropertyName("max")] - public double? Max { get; init; } - - /// Exemplars for the data point - [JsonPropertyName("exemplars")] - public IReadOnlyList? Exemplars { get; init; } - -} - -/// Instrumentation scope identifying the library/component emitting telemetry -public sealed record InstrumentationScope -{ - /// Name of the instrumentation scope (library name) - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Version of the instrumentation scope - [JsonPropertyName("version")] - public Qyl.Common.SemVer? Version { get; init; } - - /// Additional attributes for the scope - [JsonPropertyName("attributes")] - public IReadOnlyList? Attributes { get; init; } - - /// Dropped attributes count - [JsonPropertyName("dropped_attributes_count")] - public Qyl.Common.Count? DroppedAttributesCount { get; init; } - -} - -/// Internal server error (500) -public sealed record InternalServerError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - - /// Error code for support reference - [JsonPropertyName("error_code")] - public string? ErrorCode { get; init; } - -} - -/// Log aggregation request -public sealed record LogAggregation -{ - /// Group by fields - [JsonPropertyName("group_by")] - public required IReadOnlyList GroupBy { get; init; } - - /// Aggregation function - [JsonPropertyName("function")] - public required Qyl.Domains.Observe.Log.AggregationFunction Function { get; init; } - - /// Field to aggregate (for non-count) - [JsonPropertyName("field")] - public string? Field { get; init; } - - /// Time bucket (for time series) - [JsonPropertyName("time_bucket")] - public Qyl.Domains.Observe.Log.TimeBucket? TimeBucket { get; init; } - - /// Top N results - [JsonPropertyName("top_n")] - public int? TopN { get; init; } - -} - -/// Log aggregation bucket -public sealed record LogAggregationBucket -{ - /// Bucket key (group by value) - [JsonPropertyName("key")] - public required string Key { get; init; } - - /// Aggregated value - [JsonPropertyName("value")] - public required double Value { get; init; } - - /// Document count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Timestamp (for time series) - [JsonPropertyName("timestamp")] - public DateTimeOffset? Timestamp { get; init; } - -} - -/// Log aggregation request -public sealed record LogAggregationRequest -{ - /// Query filters - [JsonPropertyName("query")] - public Qyl.Domains.Observe.Log.LogQuery? Query { get; init; } - - /// Aggregation specification - [JsonPropertyName("aggregation")] - public required Qyl.Domains.Observe.Log.LogAggregation Aggregation { get; init; } - -} - -/// Log aggregation response -public sealed record LogAggregationResponse -{ - /// Aggregation results - [JsonPropertyName("results")] - public required IReadOnlyList Results { get; init; } - - /// Total matching logs - [JsonPropertyName("total_count")] - public required Qyl.Common.Count TotalCount { get; init; } - -} - -/// Log body content - can be string, structured, or bytes -public sealed record LogBody -{ -} - -/// Array log body -public sealed record LogBodyArray -{ - /// Array of values - [JsonPropertyName("array_value")] - public required IReadOnlyList ArrayValue { get; init; } - -} - -/// Binary log body -public sealed record LogBodyBytes -{ - /// Binary value (base64 encoded) - [JsonPropertyName("bytes_value")] - public required string BytesValue { get; init; } - -} - -/// Structured key-value log body -public sealed record LogBodyKvList -{ - /// Key-value pairs - [JsonPropertyName("kv_list_value")] - public required IReadOnlyList KvListValue { get; init; } - -} - -/// String log body -public sealed record LogBodyString -{ - /// String value - [JsonPropertyName("string_value")] - public required string StringValue { get; init; } - -} - -/// Log count by dimension -public sealed record LogCountByDimension -{ - /// Dimension value - [JsonPropertyName("dimension")] - public required string Dimension { get; init; } - - /// Log count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Error count for this dimension - [JsonPropertyName("error_count")] - public required Qyl.Common.Count ErrorCount { get; init; } - -} - -/// Log count by severity level -public sealed record LogCountBySeverity -{ - /// Severity level - [JsonPropertyName("severity")] - public required Qyl.OTel.Enums.SeverityText Severity { get; init; } - - /// Log count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage of total - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - -} - -/// Detected log pattern -public sealed record LogPattern -{ - /// Pattern ID - [JsonPropertyName("pattern_id")] - public required string PatternId { get; init; } - - /// Pattern template - [JsonPropertyName("template")] - public required string Template { get; init; } - - /// Sample log message - [JsonPropertyName("sample")] - public required string Sample { get; init; } - - /// Occurrence count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// First seen - [JsonPropertyName("first_seen")] - public required DateTimeOffset FirstSeen { get; init; } - - /// Last seen - [JsonPropertyName("last_seen")] - public required DateTimeOffset LastSeen { get; init; } - - /// Trend - [JsonPropertyName("trend")] - public required Qyl.Domains.Observe.Log.LogPatternTrend Trend { get; init; } - - /// Severity distribution - [JsonPropertyName("severity_distribution")] - public IReadOnlyList? SeverityDistribution { get; init; } - -} - -/// Log search query -public sealed record LogQuery -{ - /// Free text search - [JsonPropertyName("query")] - public string? Query { get; init; } - - /// Severity filter - [JsonPropertyName("severity_min")] - public Qyl.OTel.Enums.SeverityNumber? SeverityMin { get; init; } - - /// Service name filter - [JsonPropertyName("service_name")] - public string? ServiceName { get; init; } - - /// Trace ID filter - [JsonPropertyName("trace_id")] - public Qyl.Common.TraceId? TraceId { get; init; } - - /// Span ID filter - [JsonPropertyName("span_id")] - public Qyl.Common.SpanId? SpanId { get; init; } - - /// Time range start - [JsonPropertyName("time_start")] - public DateTimeOffset? TimeStart { get; init; } - - /// Time range end - [JsonPropertyName("time_end")] - public DateTimeOffset? TimeEnd { get; init; } - - /// Attribute filters - [JsonPropertyName("attribute_filters")] - public IReadOnlyList? AttributeFilters { get; init; } - - /// Limit - [JsonPropertyName("limit")] - public int? Limit { get; init; } - - /// Order by - [JsonPropertyName("order_by")] - public Qyl.Domains.Observe.Log.LogOrderBy? OrderBy { get; init; } - -} - -/// OpenTelemetry Log Record -public sealed record LogRecord -{ - /// Timestamp when the event occurred (nanoseconds since epoch) - [JsonPropertyName("time_unix_nano")] - public required long TimeUnixNano { get; init; } - - /// Timestamp when the log was observed/collected (nanoseconds since epoch) - [JsonPropertyName("observed_time_unix_nano")] - public required long ObservedTimeUnixNano { get; init; } - - /// Severity number (1-24) - [JsonPropertyName("severity_number")] - public required Qyl.OTel.Enums.SeverityNumber SeverityNumber { get; init; } - - /// Severity text (DEBUG, INFO, WARN, ERROR, etc.) - [JsonPropertyName("severity_text")] - public Qyl.OTel.Enums.SeverityText? SeverityText { get; init; } - - /// Log body - the main content - [JsonPropertyName("body")] - public required Qyl.OTel.Logs.LogBody Body { get; init; } - - /// Log attributes - [JsonPropertyName("attributes")] - public IReadOnlyList? Attributes { get; init; } - - /// Dropped attributes count - [JsonPropertyName("dropped_attributes_count")] - public Qyl.Common.Count? DroppedAttributesCount { get; init; } - - /// Flags (trace flags) - [JsonPropertyName("flags")] - public int? Flags { get; init; } - - /// Associated trace ID - [JsonPropertyName("trace_id")] - public Qyl.Common.TraceId? TraceId { get; init; } - - /// Associated span ID - [JsonPropertyName("span_id")] - public Qyl.Common.SpanId? SpanId { get; init; } - - /// Resource describing the entity that produced this log - [JsonPropertyName("resource")] - public required Qyl.OTel.Resource.Resource Resource { get; init; } - - /// Instrumentation scope - [JsonPropertyName("instrumentation_scope")] - public Qyl.Common.InstrumentationScope? InstrumentationScope { get; init; } - -} - -/// Log stats by severity -public sealed record LogSeverityStats -{ - /// Severity number - [JsonPropertyName("severity")] - public required Qyl.OTel.Enums.SeverityNumber Severity { get; init; } - - /// Severity text - [JsonPropertyName("severity_text")] - public required string SeverityText { get; init; } - - /// Count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage of total - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - -} - -/// Aggregated log statistics -public sealed record LogStats -{ - /// Total log count - [JsonPropertyName("total_count")] - public required Qyl.Common.Count TotalCount { get; init; } - - /// Log counts by severity - [JsonPropertyName("by_severity")] - public required IReadOnlyList BySeverity { get; init; } - - /// Log counts by service - [JsonPropertyName("by_service")] - public required IReadOnlyList ByService { get; init; } - - /// Logs per second rate - [JsonPropertyName("logs_per_second")] - public required double LogsPerSecond { get; init; } - - /// Error log rate - [JsonPropertyName("error_rate")] - public required Qyl.Common.Ratio ErrorRate { get; init; } - -} - -/// Log stream event -public sealed record LogStreamEvent -{ - /// Event type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Log data - [JsonPropertyName("data")] - public required Qyl.OTel.Logs.LogRecord Data { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// OpenTelemetry Metric containing measurement data -public sealed record Metric -{ - /// Metric name (e.g., http.server.request.duration) - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Metric description - [JsonPropertyName("description")] - public string? Description { get; init; } - - /// Metric unit (e.g., 's', 'By', '1') - [JsonPropertyName("unit")] - public string? Unit { get; init; } - - /// Metric data (discriminated by type) - [JsonPropertyName("data")] - public required Qyl.OTel.Metrics.MetricData Data { get; init; } - - /// Metric metadata attributes - [JsonPropertyName("metadata")] - public IReadOnlyList? Metadata { get; init; } - - /// Resource describing the entity that produced this metric - [JsonPropertyName("resource")] - public required Qyl.OTel.Resource.Resource Resource { get; init; } - - /// Instrumentation scope - [JsonPropertyName("instrumentation_scope")] - public Qyl.Common.InstrumentationScope? InstrumentationScope { get; init; } - -} - -/// Metric data discriminated by type -public sealed record MetricData -{ - /// Metric type discriminator - [JsonPropertyName("type")] - public required Qyl.OTel.Enums.MetricType Type { get; init; } - -} - -/// Metric data point -public sealed record MetricDataPoint -{ - /// Timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - - /// Value - [JsonPropertyName("value")] - public required double Value { get; init; } - -} - -/// Metric metadata -public sealed record MetricMetadata -{ - /// Metric name - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Metric description - [JsonPropertyName("description")] - public string? Description { get; init; } - - /// Metric unit - [JsonPropertyName("unit")] - public string? Unit { get; init; } - - /// Metric type - [JsonPropertyName("type")] - public required Qyl.OTel.Enums.MetricType Type { get; init; } - - /// Available label keys - [JsonPropertyName("label_keys")] - public required IReadOnlyList LabelKeys { get; init; } - - /// Services reporting this metric - [JsonPropertyName("services")] - public required IReadOnlyList Services { get; init; } - -} - -/// Metric query request -public sealed record MetricQueryRequest -{ - /// Metric name - [JsonPropertyName("metric_name")] - public required string MetricName { get; init; } - - /// Label filters - [JsonPropertyName("filters")] - public object? Filters { get; init; } - - /// Start time - [JsonPropertyName("start_time")] - public required DateTimeOffset StartTime { get; init; } - - /// End time - [JsonPropertyName("end_time")] - public required DateTimeOffset EndTime { get; init; } - - /// Step interval - [JsonPropertyName("step")] - public Qyl.Common.Pagination.TimeBucket? Step { get; init; } - - /// Aggregation function - [JsonPropertyName("aggregation")] - public Qyl.OTel.Metrics.AggregationFunction? Aggregation { get; init; } - - /// Group by labels - [JsonPropertyName("group_by")] - public IReadOnlyList? GroupBy { get; init; } - -} - -/// Metric query response -public sealed record MetricQueryResponse -{ - /// Metric name - [JsonPropertyName("metric_name")] - public required string MetricName { get; init; } - - /// Time series data - [JsonPropertyName("series")] - public required IReadOnlyList Series { get; init; } - -} - -/// Metric stream event -public sealed record MetricStreamEvent -{ - /// Event type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Metric data - [JsonPropertyName("data")] - public required Qyl.OTel.Metrics.Metric Data { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Metric time series -public sealed record MetricTimeSeries -{ - /// Labels - [JsonPropertyName("labels")] - public required object Labels { get; init; } - - /// Data points - [JsonPropertyName("points")] - public required IReadOnlyList Points { get; init; } - -} - -/// Resource not found (404) -public sealed record NotFoundError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - - /// The type of resource that was not found - [JsonPropertyName("resource_type")] - public string? ResourceType { get; init; } - - /// The identifier that was not found - [JsonPropertyName("resource_id")] - public string? ResourceId { get; init; } - -} - -/// Numeric data point (for Gauge and Sum) -public sealed record NumberDataPoint -{ - /// Value as integer - [JsonPropertyName("as_int")] - public long? AsInt { get; init; } - - /// Value as double - [JsonPropertyName("as_double")] - public double? AsDouble { get; init; } - - /// Exemplars for the data point - [JsonPropertyName("exemplars")] - public IReadOnlyList? Exemplars { get; init; } - -} - -/// Operation information -public sealed record OperationInfo -{ - /// Operation name - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Span kind - [JsonPropertyName("span_kind")] - public required Qyl.OTel.Enums.SpanKind SpanKind { get; init; } - - /// Request count - [JsonPropertyName("request_count")] - public required Qyl.Common.Count RequestCount { get; init; } - - /// Error count - [JsonPropertyName("error_count")] - public required Qyl.Common.Count ErrorCount { get; init; } - - /// Average duration in milliseconds - [JsonPropertyName("avg_duration_ms")] - public required double AvgDurationMs { get; init; } - - /// P99 duration in milliseconds - [JsonPropertyName("p99_duration_ms")] - public required double P99DurationMs { get; init; } - -} - -/// Pipeline run event -public sealed record PipelineRunEvent -{ - /// Event name - [JsonPropertyName("event.name")] - public required Qyl.Domains.Ops.Cicd.CicdEventName EventName { get; init; } - - /// Pipeline name - [JsonPropertyName("cicd.pipeline.name")] - public required string CicdPipelineName { get; init; } - - /// Pipeline run ID - [JsonPropertyName("cicd.pipeline.run.id")] - public required string CicdPipelineRunId { get; init; } - - /// Pipeline status - [JsonPropertyName("status")] - public required Qyl.Domains.Ops.Cicd.CicdPipelineStatus Status { get; init; } - - /// CI/CD system - [JsonPropertyName("system")] - public required Qyl.Domains.Ops.Cicd.CicdSystem System { get; init; } - - /// Trigger type - [JsonPropertyName("trigger_type")] - public Qyl.Domains.Ops.Cicd.CicdTriggerType? TriggerType { get; init; } - - /// Git branch - [JsonPropertyName("vcs.repository.ref.name")] - public string? VcsRepositoryRefName { get; init; } - - /// Git commit SHA - [JsonPropertyName("vcs.repository.ref.revision")] - public string? VcsRepositoryRefRevision { get; init; } - - /// Duration in seconds - [JsonPropertyName("duration_s")] - public Qyl.Common.DurationS? DurationS { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Pipeline statistics -public sealed record PipelineStats -{ - /// Total runs - [JsonPropertyName("total_runs")] - public required Qyl.Common.Count TotalRuns { get; init; } - - /// Success rate - [JsonPropertyName("success_rate")] - public required Qyl.Common.Ratio SuccessRate { get; init; } - - /// Average duration in seconds - [JsonPropertyName("avg_duration_seconds")] - public required double AvgDurationSeconds { get; init; } - - /// P95 duration in seconds - [JsonPropertyName("p95_duration_seconds")] - public required double P95DurationSeconds { get; init; } - - /// Runs by status - [JsonPropertyName("by_status")] - public required IReadOnlyList ByStatus { get; init; } - -} - -/// Pipeline status statistics -public sealed record PipelineStatusStats -{ - /// Status - [JsonPropertyName("status")] - public required Qyl.Domains.Ops.Cicd.CicdPipelineStatus Status { get; init; } - - /// Count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - -} - -/// RFC 7807 Problem Details for HTTP APIs -public sealed record ProblemDetails -{ - /// A URI reference identifying the problem type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// A short, human-readable summary of the problem type - [JsonPropertyName("title")] - public required string Title { get; init; } - - /// The HTTP status code (informational only, actual code set by subtype) - [JsonPropertyName("status")] - public required int Status { get; init; } - - /// A human-readable explanation specific to this occurrence - [JsonPropertyName("detail")] - public string? Detail { get; init; } - - /// A URI reference identifying the specific occurrence - [JsonPropertyName("instance")] - public string? Instance { get; init; } - - /// Timestamp of the error - [JsonPropertyName("timestamp")] - public DateTimeOffset? Timestamp { get; init; } - -} - -/// Quantile value for summary -public sealed record QuantileValue -{ - /// Quantile (0.0 to 1.0) - [JsonPropertyName("quantile")] - public required double Quantile { get; init; } - - /// Value at this quantile - [JsonPropertyName("value")] - public required double Value { get; init; } - -} - -/// Rate limited - too many requests (429) -public sealed record RateLimitError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - -} - -/// Resource describes the entity producing telemetry -public sealed record Resource -{ - /// Service name (required) - [JsonPropertyName("service.name")] - public required string ServiceName { get; init; } - - /// Service namespace for grouping - [JsonPropertyName("service.namespace")] - public string? ServiceNamespace { get; init; } - - /// Service instance ID (unique per instance) - [JsonPropertyName("service.instance.id")] - public string? ServiceInstanceId { get; init; } - - /// Service version - [JsonPropertyName("service.version")] - public Qyl.Common.SemVer? ServiceVersion { get; init; } - - /// Telemetry SDK name - [JsonPropertyName("telemetry.sdk.name")] - public string? TelemetrySdkName { get; init; } - - /// Telemetry SDK language - [JsonPropertyName("telemetry.sdk.language")] - public Qyl.OTel.Enums.TelemetrySdkLanguage? TelemetrySdkLanguage { get; init; } - - /// Telemetry SDK version - [JsonPropertyName("telemetry.sdk.version")] - public Qyl.Common.SemVer? TelemetrySdkVersion { get; init; } - - /// Auto-instrumentation agent name - [JsonPropertyName("telemetry.auto.version")] - public Qyl.Common.SemVer? TelemetryAutoVersion { get; init; } - - /// Deployment environment (e.g., production, staging) - [JsonPropertyName("deployment.environment.name")] - public string? DeploymentEnvironmentName { get; init; } - - /// Cloud provider - [JsonPropertyName("cloud.provider")] - public Qyl.OTel.Resource.CloudProvider? CloudProvider { get; init; } - - /// Cloud region - [JsonPropertyName("cloud.region")] - public string? CloudRegion { get; init; } - - /// Cloud availability zone - [JsonPropertyName("cloud.availability_zone")] - public string? CloudAvailabilityZone { get; init; } - - /// Cloud account ID - [JsonPropertyName("cloud.account.id")] - public string? CloudAccountId { get; init; } - - /// Cloud platform (e.g., aws_ecs, gcp_cloud_run) - [JsonPropertyName("cloud.platform")] - public string? CloudPlatform { get; init; } - - /// Host name - [JsonPropertyName("host.name")] - public string? HostName { get; init; } - - /// Host ID - [JsonPropertyName("host.id")] - public string? HostId { get; init; } - - /// Host type (e.g., n1-standard-1) - [JsonPropertyName("host.type")] - public string? HostType { get; init; } - - /// Host architecture (e.g., amd64, arm64) - [JsonPropertyName("host.arch")] - public Qyl.OTel.Resource.HostArch? HostArch { get; init; } - - /// Operating system type - [JsonPropertyName("os.type")] - public Qyl.OTel.Resource.OsType? OsType { get; init; } - - /// Operating system description - [JsonPropertyName("os.description")] - public string? OsDescription { get; init; } - - /// Operating system version - [JsonPropertyName("os.version")] - public string? OsVersion { get; init; } - - /// Process ID - [JsonPropertyName("process.pid")] - public long? ProcessPid { get; init; } - - /// Process executable name - [JsonPropertyName("process.executable.name")] - public string? ProcessExecutableName { get; init; } - - /// Process command line - [JsonPropertyName("process.command_line")] - public string? ProcessCommandLine { get; init; } - - /// Process runtime name - [JsonPropertyName("process.runtime.name")] - public string? ProcessRuntimeName { get; init; } - - /// Process runtime version - [JsonPropertyName("process.runtime.version")] - public string? ProcessRuntimeVersion { get; init; } - - /// Container ID - [JsonPropertyName("container.id")] - public string? ContainerId { get; init; } - - /// Container name - [JsonPropertyName("container.name")] - public string? ContainerName { get; init; } - - /// Container image name - [JsonPropertyName("container.image.name")] - public string? ContainerImageName { get; init; } - - /// Container image tag - [JsonPropertyName("container.image.tag")] - public string? ContainerImageTag { get; init; } - - /// Kubernetes cluster name - [JsonPropertyName("k8s.cluster.name")] - public string? K8sClusterName { get; init; } - - /// Kubernetes namespace - [JsonPropertyName("k8s.namespace.name")] - public string? K8sNamespaceName { get; init; } - - /// Kubernetes pod name - [JsonPropertyName("k8s.pod.name")] - public string? K8sPodName { get; init; } - - /// Kubernetes pod UID - [JsonPropertyName("k8s.pod.uid")] - public string? K8sPodUid { get; init; } - - /// Kubernetes deployment name - [JsonPropertyName("k8s.deployment.name")] - public string? K8sDeploymentName { get; init; } - - /// Additional resource attributes - [JsonPropertyName("attributes")] - public IReadOnlyList? Attributes { get; init; } - - /// Dropped attributes count - [JsonPropertyName("dropped_attributes_count")] - public Qyl.Common.Count? DroppedAttributesCount { get; init; } - -} - -/// Service dependency map -public sealed record ServiceDependency -{ - /// Source service - [JsonPropertyName("source_service")] - public required string SourceService { get; init; } - - /// Target service - [JsonPropertyName("target_service")] - public required string TargetService { get; init; } - - /// Request count - [JsonPropertyName("request_count")] - public required Qyl.Common.Count RequestCount { get; init; } - - /// Error rate - [JsonPropertyName("error_rate")] - public required Qyl.Common.Ratio ErrorRate { get; init; } - - /// Average latency in milliseconds - [JsonPropertyName("avg_latency_ms")] - public required double AvgLatencyMs { get; init; } - -} - -/// Service details -public sealed record ServiceDetails -{ - /// Service name - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Service namespace - [JsonPropertyName("namespace_name")] - public string? NamespaceName { get; init; } - - /// Service version - [JsonPropertyName("version")] - public Qyl.Common.SemVer? Version { get; init; } - - /// Instance count - [JsonPropertyName("instance_count")] - public required int InstanceCount { get; init; } - - /// Last seen - [JsonPropertyName("last_seen")] - public required DateTimeOffset LastSeen { get; init; } - - /// Resource attributes - [JsonPropertyName("resource_attributes")] - public required IReadOnlyList ResourceAttributes { get; init; } - - /// Instrumentation libraries - [JsonPropertyName("instrumentation_libraries")] - public required IReadOnlyList InstrumentationLibraries { get; init; } - - /// Request rate (per second) - [JsonPropertyName("request_rate")] - public required double RequestRate { get; init; } - - /// Error rate - [JsonPropertyName("error_rate")] - public required Qyl.Common.Ratio ErrorRate { get; init; } - - /// Average latency in milliseconds - [JsonPropertyName("avg_latency_ms")] - public required double AvgLatencyMs { get; init; } - - /// P99 latency in milliseconds - [JsonPropertyName("p99_latency_ms")] - public required double P99LatencyMs { get; init; } - -} - -/// Service information -public sealed record ServiceInfo -{ - /// Service name - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Service namespace - [JsonPropertyName("namespace_name")] - public string? NamespaceName { get; init; } - - /// Service version - [JsonPropertyName("version")] - public Qyl.Common.SemVer? Version { get; init; } - - /// Instance count - [JsonPropertyName("instance_count")] - public required int InstanceCount { get; init; } - - /// Last seen - [JsonPropertyName("last_seen")] - public required DateTimeOffset LastSeen { get; init; } - -} - -/// Service unavailable (503) -public sealed record ServiceUnavailableError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - - /// Reason for unavailability - [JsonPropertyName("reason")] - public string? Reason { get; init; } - -} - -/// Session client information -public sealed record SessionClientInfo -{ - /// Client IP address - [JsonPropertyName("ip")] - public Qyl.Common.IpAddress? Ip { get; init; } - - /// User agent string - [JsonPropertyName("user_agent")] - public Qyl.Common.UserAgent? UserAgent { get; init; } - - /// Device type - [JsonPropertyName("device_type")] - public Qyl.Domains.Observe.Session.DeviceType? DeviceType { get; init; } - - /// Operating system - [JsonPropertyName("os")] - public string? Os { get; init; } - - /// Browser name - [JsonPropertyName("browser")] - public string? Browser { get; init; } - - /// Browser version - [JsonPropertyName("browser_version")] - public string? BrowserVersion { get; init; } - -} - -/// Session stats by country -public sealed record SessionCountryStats -{ - /// Country code - [JsonPropertyName("country_code")] - public required string CountryCode { get; init; } - - /// Country name - [JsonPropertyName("country_name")] - public required string CountryName { get; init; } - - /// Session count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage of total - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - -} - -/// Session stats by device type -public sealed record SessionDeviceStats -{ - /// Device type - [JsonPropertyName("device_type")] - public required Qyl.Domains.Observe.Session.DeviceType DeviceType { get; init; } - - /// Session count - [JsonPropertyName("count")] - public required Qyl.Common.Count Count { get; init; } - - /// Percentage of total - [JsonPropertyName("percentage")] - public required Qyl.Common.Percentage Percentage { get; init; } - -} - -/// Complete session entity with aggregated data -public sealed record SessionEntity -{ - /// Session ID - [JsonPropertyName("session.id")] - public required Qyl.Common.SessionId SessionId { get; init; } - - /// User ID (if authenticated) - [JsonPropertyName("user.id")] - public Qyl.Common.UserId? UserId { get; init; } - - /// Session start time - [JsonPropertyName("start_time")] - public required DateTimeOffset StartTime { get; init; } - - /// Session end time - [JsonPropertyName("end_time")] - public DateTimeOffset? EndTime { get; init; } - - /// Session duration in milliseconds - [JsonPropertyName("duration_ms")] - public Qyl.Common.DurationMs? DurationMs { get; init; } - - /// Total trace count in session - [JsonPropertyName("trace_count")] - public required int TraceCount { get; init; } - - /// Total span count in session - [JsonPropertyName("span_count")] - public required int SpanCount { get; init; } - - /// Total error count in session - [JsonPropertyName("error_count")] - public required int ErrorCount { get; init; } - - /// Session state - [JsonPropertyName("state")] - public required Qyl.Domains.Observe.Session.SessionState State { get; init; } - - /// Client information - [JsonPropertyName("client")] - public Qyl.Domains.Observe.Session.SessionClientInfo? Client { get; init; } - - /// Location information - [JsonPropertyName("geo")] - public Qyl.Domains.Observe.Session.SessionGeoInfo? Geo { get; init; } - - /// GenAI usage summary - [JsonPropertyName("genai_usage")] - public Qyl.Domains.Observe.Session.SessionGenAiUsage? GenaiUsage { get; init; } - -} - -/// Session GenAI usage summary -public sealed record SessionGenAiUsage -{ - /// Total GenAI requests in session - [JsonPropertyName("request_count")] - public required int RequestCount { get; init; } - - /// Total input tokens consumed - [JsonPropertyName("total_input_tokens")] - public required Qyl.Common.TokenCount TotalInputTokens { get; init; } - - /// Total output tokens generated - [JsonPropertyName("total_output_tokens")] - public required Qyl.Common.TokenCount TotalOutputTokens { get; init; } - - /// Models used in session - [JsonPropertyName("models_used")] - public required IReadOnlyList ModelsUsed { get; init; } - - /// Providers used in session - [JsonPropertyName("providers_used")] - public required IReadOnlyList ProvidersUsed { get; init; } - - /// Estimated cost in USD - [JsonPropertyName("estimated_cost_usd")] - public double? EstimatedCostUsd { get; init; } - -} - -/// Session geographic information -public sealed record SessionGeoInfo -{ - /// Country code (ISO 3166-1 alpha-2) - [JsonPropertyName("country_code")] - public string? CountryCode { get; init; } - - /// Country name - [JsonPropertyName("country_name")] - public string? CountryName { get; init; } - - /// Region/state - [JsonPropertyName("region")] - public string? Region { get; init; } - - /// City - [JsonPropertyName("city")] - public string? City { get; init; } - - /// Postal code - [JsonPropertyName("postal_code")] - public string? PostalCode { get; init; } - - /// Timezone - [JsonPropertyName("timezone")] - public string? Timezone { get; init; } - -} - -/// Aggregated session statistics -public sealed record SessionStats -{ - /// Active sessions count - [JsonPropertyName("active_sessions")] - public required Qyl.Common.Count ActiveSessions { get; init; } - - /// Total sessions in time range - [JsonPropertyName("total_sessions")] - public required Qyl.Common.Count TotalSessions { get; init; } - - /// Unique users in time range - [JsonPropertyName("unique_users")] - public required Qyl.Common.Count UniqueUsers { get; init; } - - /// Average session duration in milliseconds - [JsonPropertyName("avg_duration_ms")] - public required double AvgDurationMs { get; init; } - - /// Sessions with errors - [JsonPropertyName("sessions_with_errors")] - public required Qyl.Common.Count SessionsWithErrors { get; init; } - - /// Sessions with GenAI usage - [JsonPropertyName("sessions_with_genai")] - public required Qyl.Common.Count SessionsWithGenai { get; init; } - - /// Bounce rate (single-page sessions) - [JsonPropertyName("bounce_rate")] - public required Qyl.Common.Ratio BounceRate { get; init; } - - /// Sessions by device type - [JsonPropertyName("by_device_type")] - public IReadOnlyList? ByDeviceType { get; init; } - - /// Sessions by country - [JsonPropertyName("by_country")] - public IReadOnlyList? ByCountry { get; init; } - -} - -/// OpenTelemetry Span representing a single operation in a distributed trace -public sealed record Span -{ - /// Unique span identifier (16 hex chars) - [JsonPropertyName("span_id")] - public required Qyl.Common.SpanId SpanId { get; init; } - - /// Trace identifier (32 hex chars) - [JsonPropertyName("trace_id")] - public required Qyl.Common.TraceId TraceId { get; init; } - - /// Parent span identifier (null for root spans) - [JsonPropertyName("parent_span_id")] - public Qyl.Common.SpanId? ParentSpanId { get; init; } - - /// W3C trace state - [JsonPropertyName("trace_state")] - public Qyl.Common.TraceState? TraceState { get; init; } - - /// Human-readable span name - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Span kind - [JsonPropertyName("kind")] - public required Qyl.OTel.Enums.SpanKind Kind { get; init; } - - /// Start timestamp in nanoseconds since epoch - [JsonPropertyName("start_time_unix_nano")] - public required long StartTimeUnixNano { get; init; } - - /// End timestamp in nanoseconds since epoch - [JsonPropertyName("end_time_unix_nano")] - public required long EndTimeUnixNano { get; init; } - - /// Span attributes - [JsonPropertyName("attributes")] - public IReadOnlyList? Attributes { get; init; } - - /// Dropped attributes count - [JsonPropertyName("dropped_attributes_count")] - public Qyl.Common.Count? DroppedAttributesCount { get; init; } - - /// Span events (logs attached to span) - [JsonPropertyName("events")] - public IReadOnlyList? Events { get; init; } - - /// Dropped events count - [JsonPropertyName("dropped_events_count")] - public Qyl.Common.Count? DroppedEventsCount { get; init; } - - /// Links to other spans - [JsonPropertyName("links")] - public IReadOnlyList? Links { get; init; } - - /// Dropped links count - [JsonPropertyName("dropped_links_count")] - public Qyl.Common.Count? DroppedLinksCount { get; init; } - - /// Span status - [JsonPropertyName("status")] - public required Qyl.OTel.Traces.SpanStatus Status { get; init; } - - /// Span flags - [JsonPropertyName("flags")] - public int? Flags { get; init; } - - /// Resource describing the entity that produced this span - [JsonPropertyName("resource")] - public required Qyl.OTel.Resource.Resource Resource { get; init; } - - /// Instrumentation scope - [JsonPropertyName("instrumentation_scope")] - public Qyl.Common.InstrumentationScope? InstrumentationScope { get; init; } - -} - -/// Event occurring during a span's lifetime -public sealed record SpanEvent -{ - /// Event name - [JsonPropertyName("name")] - public required string Name { get; init; } - - /// Event timestamp in nanoseconds since epoch - [JsonPropertyName("time_unix_nano")] - public required long TimeUnixNano { get; init; } - - /// Event attributes - [JsonPropertyName("attributes")] - public IReadOnlyList? Attributes { get; init; } - - /// Dropped attributes count - [JsonPropertyName("dropped_attributes_count")] - public Qyl.Common.Count? DroppedAttributesCount { get; init; } - -} - -/// Link to another span (e.g., batch processing) -public sealed record SpanLink -{ - /// Linked trace ID - [JsonPropertyName("trace_id")] - public required Qyl.Common.TraceId TraceId { get; init; } - - /// Linked span ID - [JsonPropertyName("span_id")] - public required Qyl.Common.SpanId SpanId { get; init; } - - /// Trace state of the linked span - [JsonPropertyName("trace_state")] - public Qyl.Common.TraceState? TraceState { get; init; } - - /// Link attributes - [JsonPropertyName("attributes")] - public IReadOnlyList? Attributes { get; init; } - - /// Dropped attributes count - [JsonPropertyName("dropped_attributes_count")] - public Qyl.Common.Count? DroppedAttributesCount { get; init; } - - /// Link flags - [JsonPropertyName("flags")] - public int? Flags { get; init; } - -} - -/// Span status -public sealed record SpanStatus -{ - /// Status code - [JsonPropertyName("code")] - public required Qyl.OTel.Enums.SpanStatusCode Code { get; init; } - - /// Status message (only for ERROR status) - [JsonPropertyName("message")] - public string? Message { get; init; } - -} - -/// Span stream event -public sealed record SpanStreamEvent -{ - /// Event type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Span data - [JsonPropertyName("data")] - public required Qyl.OTel.Traces.Span Data { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Single frame in a call stack -public sealed record StackFrame -{ - /// Frame index (0 = top of stack) - [JsonPropertyName("index")] - public required int Index { get; init; } - - /// Source location - [JsonPropertyName("location")] - public required Qyl.Domains.AI.Code.CodeLocation Location { get; init; } - - /// Whether this is user code (not library/framework) - [JsonPropertyName("is_user_code")] - public bool? IsUserCode { get; init; } - - /// Assembly/module name - [JsonPropertyName("module_name")] - public string? ModuleName { get; init; } - - /// Assembly/module version - [JsonPropertyName("module_version")] - public Qyl.Common.SemVer? ModuleVersion { get; init; } - - /// Native/managed indicator - [JsonPropertyName("is_native")] - public bool? IsNative { get; init; } - -} - -/// Full stack trace -public sealed record StackTrace -{ - /// Stack frames (top to bottom) - [JsonPropertyName("frames")] - public required IReadOnlyList Frames { get; init; } - - /// Whether the stack was truncated - [JsonPropertyName("truncated")] - public bool? Truncated { get; init; } - - /// Total frame count before truncation - [JsonPropertyName("total_frames")] - public int? TotalFrames { get; init; } - -} - -/// Stream subscription request -public sealed record StreamSubscription -{ - /// Event types to subscribe to - [JsonPropertyName("event_types")] - public required IReadOnlyList EventTypes { get; init; } - - /// Service name filter - [JsonPropertyName("service_name")] - public string? ServiceName { get; init; } - - /// Trace ID filter (for specific trace) - [JsonPropertyName("trace_id")] - public Qyl.Common.TraceId? TraceId { get; init; } - - /// Minimum severity for logs (1-24) - [JsonPropertyName("min_severity")] - public int? MinSeverity { get; init; } - - /// Attribute filters - [JsonPropertyName("filters")] - public object? Filters { get; init; } - - /// Sample rate (0.0-1.0) - [JsonPropertyName("sample_rate")] - public double? SampleRate { get; init; } - -} - -/// Sum metric - cumulative or delta counter -public sealed record SumData -{ - /// Discriminator identifying this as sum metric data - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Sum data points - [JsonPropertyName("data_points")] - public required IReadOnlyList DataPoints { get; init; } - - /// Whether the sum is monotonically increasing - [JsonPropertyName("is_monotonic")] - public required bool IsMonotonic { get; init; } - - /// Aggregation temporality - [JsonPropertyName("aggregation_temporality")] - public required Qyl.OTel.Enums.AggregationTemporality AggregationTemporality { get; init; } - -} - -/// Summary metric - pre-aggregated quantile distribution -public sealed record SummaryData -{ - /// Discriminator identifying this as summary metric data - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Summary data points - [JsonPropertyName("data_points")] - public required IReadOnlyList DataPoints { get; init; } - -} - -/// Summary data point -public sealed record SummaryDataPoint -{ - /// Number of values - [JsonPropertyName("count")] - public required long Count { get; init; } - - /// Sum of all values - [JsonPropertyName("sum")] - public required double Sum { get; init; } - - /// Quantile values - [JsonPropertyName("quantile_values")] - public required IReadOnlyList QuantileValues { get; init; } - -} - -/// Tail-based sampling configuration for streaming -public sealed record TailSamplingConfig -{ - /// Enable tail-based sampling - [JsonPropertyName("enabled")] - public required bool Enabled { get; init; } - - /// Sample error traces - [JsonPropertyName("sample_errors")] - public required bool SampleErrors { get; init; } - - /// Sample slow traces (above threshold) - [JsonPropertyName("sample_slow")] - public required bool SampleSlow { get; init; } - - /// Slow trace threshold in milliseconds - [JsonPropertyName("slow_threshold_ms")] - public long? SlowThresholdMs { get; init; } - - /// Random sample rate for remaining traces - [JsonPropertyName("random_rate")] - public required double RandomRate { get; init; } - -} - -/// Complete trace containing all related spans -public sealed record Trace -{ - /// Trace identifier - [JsonPropertyName("trace_id")] - public required Qyl.Common.TraceId TraceId { get; init; } - - /// All spans in this trace - [JsonPropertyName("spans")] - public required IReadOnlyList Spans { get; init; } - - /// Root span of the trace - [JsonPropertyName("root_span")] - public Qyl.OTel.Traces.Span? RootSpan { get; init; } - - /// Total span count - [JsonPropertyName("span_count")] - public required int SpanCount { get; init; } - - /// Trace duration in nanoseconds - [JsonPropertyName("duration_ns")] - public required Qyl.Common.DurationNs DurationNs { get; init; } - - /// Trace start time - [JsonPropertyName("start_time")] - public required DateTimeOffset StartTime { get; init; } - - /// Trace end time - [JsonPropertyName("end_time")] - public required DateTimeOffset EndTime { get; init; } - - /// Services involved in this trace - [JsonPropertyName("services")] - public required IReadOnlyList Services { get; init; } - - /// Whether trace contains errors - [JsonPropertyName("has_error")] - public required bool HasError { get; init; } - -} - -/// Trace search query -public sealed record TraceQuery -{ - /// Free text search - [JsonPropertyName("query")] - public string? Query { get; init; } - - /// Service name filter - [JsonPropertyName("service_name")] - public string? ServiceName { get; init; } - - /// Operation name filter - [JsonPropertyName("operation_name")] - public string? OperationName { get; init; } - - /// Minimum duration in milliseconds - [JsonPropertyName("min_duration_ms")] - public long? MinDurationMs { get; init; } - - /// Maximum duration in milliseconds - [JsonPropertyName("max_duration_ms")] - public long? MaxDurationMs { get; init; } - - /// Status filter - [JsonPropertyName("status")] - public Qyl.OTel.Enums.SpanStatusCode? Status { get; init; } - - /// Time range start - [JsonPropertyName("start_time")] - public DateTimeOffset? StartTime { get; init; } - - /// Time range end - [JsonPropertyName("end_time")] - public DateTimeOffset? EndTime { get; init; } - - /// Tag filters - [JsonPropertyName("tags")] - public object? Tags { get; init; } - - /// Page size - [JsonPropertyName("limit")] - public int? Limit { get; init; } - - /// Cursor - [JsonPropertyName("cursor")] - public string? Cursor { get; init; } - -} - -/// Trace stream event -public sealed record TraceStreamEvent -{ - /// Event type - [JsonPropertyName("type")] - public required string Type { get; init; } - - /// Trace data - [JsonPropertyName("data")] - public required Qyl.OTel.Traces.Trace Data { get; init; } - - /// Event timestamp - [JsonPropertyName("timestamp")] - public required DateTimeOffset Timestamp { get; init; } - -} - -/// Unauthorized - authentication required (401) -public sealed record UnauthorizedError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - -} - -/// Bad request - validation failed (400) -public sealed record ValidationError -{ - [JsonPropertyName("title")] - public required string Title { get; init; } - - /// List of validation errors - [JsonPropertyName("errors")] - public required IReadOnlyList Errors { get; init; } - -} - -/// Individual validation error detail -public sealed record ValidationErrorDetail -{ - /// The field/property that failed validation - [JsonPropertyName("field")] - public required string Field { get; init; } - - /// The error message - [JsonPropertyName("message")] - public required string Message { get; init; } - - /// The validation rule that failed - [JsonPropertyName("code")] - public required string Code { get; init; } - - /// The rejected value (if safe to include) - [JsonPropertyName("rejected_value")] - public string? RejectedValue { get; init; } - -} - diff --git a/core/protocol/Primitives/Scalars.g.cs b/core/protocol/Primitives/Scalars.g.cs deleted file mode 100644 index 4b2a1c7a7..000000000 --- a/core/protocol/Primitives/Scalars.g.cs +++ /dev/null @@ -1,305 +0,0 @@ -// ============================================================================= -// AUTO-GENERATED FILE - DO NOT EDIT -// ============================================================================= -// Source: /Users/ancplua/qyl/core/openapi/openapi.yaml -// Generated: 2026-01-16T09:00:34.9249700+00:00 -// Strongly-typed scalar primitives -// ============================================================================= - -#nullable enable - -namespace Qyl; - -/// Generic non-negative counter -[System.Text.Json.Serialization.JsonConverter(typeof(CountJsonConverter))] -public readonly partial record struct Count(long Value) -{ - public static implicit operator long(Count v) => v.Value; - public static implicit operator Count(long v) => new(v); - public override string ToString() => Value.ToString(); - public bool IsValid => true; -} - -file sealed class CountJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override Count Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetInt64()); - public override void Write(System.Text.Json.Utf8JsonWriter writer, Count value, System.Text.Json.JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); -} - -/// Duration in milliseconds -[System.Text.Json.Serialization.JsonConverter(typeof(DurationMsJsonConverter))] -public readonly partial record struct DurationMs(double Value) -{ - public static implicit operator double(DurationMs v) => v.Value; - public static implicit operator DurationMs(double v) => new(v); - public override string ToString() => Value.ToString(); - public bool IsValid => true; -} - -file sealed class DurationMsJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override DurationMs Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetDouble()); - public override void Write(System.Text.Json.Utf8JsonWriter writer, DurationMs value, System.Text.Json.JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); -} - -/// Duration in nanoseconds -[System.Text.Json.Serialization.JsonConverter(typeof(DurationNsJsonConverter))] -public readonly partial record struct DurationNs(long Value) -{ - public static implicit operator long(DurationNs v) => v.Value; - public static implicit operator DurationNs(long v) => new(v); - public override string ToString() => Value.ToString(); - public bool IsValid => true; -} - -file sealed class DurationNsJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override DurationNs Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetInt64()); - public override void Write(System.Text.Json.Utf8JsonWriter writer, DurationNs value, System.Text.Json.JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); -} - -/// Duration in seconds -[System.Text.Json.Serialization.JsonConverter(typeof(DurationSJsonConverter))] -public readonly partial record struct DurationS(double Value) -{ - public static implicit operator double(DurationS v) => v.Value; - public static implicit operator DurationS(double v) => new(v); - public override string ToString() => Value.ToString(); - public bool IsValid => true; -} - -file sealed class DurationSJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override DurationS Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetDouble()); - public override void Write(System.Text.Json.Utf8JsonWriter writer, DurationS value, System.Text.Json.JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); -} - -/// IP address (IPv4 or IPv6) -[System.Text.Json.Serialization.JsonConverter(typeof(IpAddressJsonConverter))] -public readonly partial record struct IpAddress(string Value) -{ - public static implicit operator string(IpAddress v) => v.Value; - public static implicit operator IpAddress(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - public bool IsValid => !string.IsNullOrEmpty(Value); -} - -file sealed class IpAddressJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override IpAddress Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, IpAddress value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// Percentage value (0.0 to 100.0) -[System.Text.Json.Serialization.JsonConverter(typeof(PercentageJsonConverter))] -public readonly partial record struct Percentage(double Value) -{ - public static implicit operator double(Percentage v) => v.Value; - public static implicit operator Percentage(double v) => new(v); - public override string ToString() => Value.ToString(); - public bool IsValid => true; -} - -file sealed class PercentageJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override Percentage Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetDouble()); - public override void Write(System.Text.Json.Utf8JsonWriter writer, Percentage value, System.Text.Json.JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); -} - -/// Ratio value (0.0 to 1.0) -[System.Text.Json.Serialization.JsonConverter(typeof(RatioJsonConverter))] -public readonly partial record struct Ratio(double Value) -{ - public static implicit operator double(Ratio v) => v.Value; - public static implicit operator Ratio(double v) => new(v); - public override string ToString() => Value.ToString(); - public bool IsValid => true; -} - -file sealed class RatioJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override Ratio Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetDouble()); - public override void Write(System.Text.Json.Utf8JsonWriter writer, Ratio value, System.Text.Json.JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); -} - -/// Semantic version string (e.g., 1.2.3) -[System.Text.Json.Serialization.JsonConverter(typeof(SemVerJsonConverter))] -public readonly partial record struct SemVer(string Value) -{ - public static implicit operator string(SemVer v) => v.Value; - public static implicit operator SemVer(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - private static readonly System.Text.RegularExpressions.Regex s_pattern = new(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", System.Text.RegularExpressions.RegexOptions.Compiled); - public bool IsValid => !string.IsNullOrEmpty(Value) && s_pattern.IsMatch(Value); -} - -file sealed class SemVerJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override SemVer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, SemVer value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// Unique session identifier -[System.Text.Json.Serialization.JsonConverter(typeof(SessionIdJsonConverter))] -public readonly partial record struct SessionId(string Value) -{ - public static implicit operator string(SessionId v) => v.Value; - public static implicit operator SessionId(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - public bool IsValid => !string.IsNullOrEmpty(Value); -} - -file sealed class SessionIdJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override SessionId Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, SessionId value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// Unique span identifier (16 lowercase hex characters) -[System.Text.Json.Serialization.JsonConverter(typeof(SpanIdJsonConverter))] -public readonly partial record struct SpanId(string Value) : System.IParsable, System.ISpanFormattable -{ - public static implicit operator string(SpanId v) => v.Value; - public static implicit operator SpanId(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - private static readonly System.Text.RegularExpressions.Regex s_pattern = new(@"^[a-f0-9]{16}$", System.Text.RegularExpressions.RegexOptions.Compiled); - public bool IsValid => !string.IsNullOrEmpty(Value) && s_pattern.IsMatch(Value); - - public static SpanId Empty => new("0000000000000000"); - public bool IsEmpty => string.IsNullOrEmpty(Value) || Value == "0000000000000000"; - - public static SpanId Parse(string s, IFormatProvider? provider) => TryParse(s, provider, out var r) ? r : throw new FormatException($"Invalid SpanId: {s}"); - public static bool TryParse(string? s, IFormatProvider? provider, out SpanId result) - { - if (s is { Length: 16 } && IsValidHex(s.AsSpan())) { result = new(s); return true; } - result = default; return false; - } - public bool TryFormat(Span dest, out int written, ReadOnlySpan format, IFormatProvider? provider) - { - if (dest.Length < 16 || string.IsNullOrEmpty(Value)) { written = 0; return false; } - Value.AsSpan().CopyTo(dest); written = 16; return true; - } - string IFormattable.ToString(string? format, IFormatProvider? provider) => Value ?? string.Empty; - static bool IsValidHex(ReadOnlySpan s) { foreach (var c in s) if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))) return false; return true; } -} - -file sealed class SpanIdJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override SpanId Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, SpanId value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// Token count (for LLM operations) -[System.Text.Json.Serialization.JsonConverter(typeof(TokenCountJsonConverter))] -public readonly partial record struct TokenCount(long Value) -{ - public static implicit operator long(TokenCount v) => v.Value; - public static implicit operator TokenCount(long v) => new(v); - public override string ToString() => Value.ToString(); - public bool IsValid => true; -} - -file sealed class TokenCountJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override TokenCount Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetInt64()); - public override void Write(System.Text.Json.Utf8JsonWriter writer, TokenCount value, System.Text.Json.JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); -} - -/// Unique trace identifier (32 lowercase hex characters) -[System.Text.Json.Serialization.JsonConverter(typeof(TraceIdJsonConverter))] -public readonly partial record struct TraceId(string Value) : System.IParsable, System.ISpanFormattable -{ - public static implicit operator string(TraceId v) => v.Value; - public static implicit operator TraceId(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - private static readonly System.Text.RegularExpressions.Regex s_pattern = new(@"^[a-f0-9]{32}$", System.Text.RegularExpressions.RegexOptions.Compiled); - public bool IsValid => !string.IsNullOrEmpty(Value) && s_pattern.IsMatch(Value); - - public static TraceId Empty => new("00000000000000000000000000000000"); - public bool IsEmpty => string.IsNullOrEmpty(Value) || Value == "00000000000000000000000000000000"; - - public static TraceId Parse(string s, IFormatProvider? provider) => TryParse(s, provider, out var r) ? r : throw new FormatException($"Invalid TraceId: {s}"); - public static bool TryParse(string? s, IFormatProvider? provider, out TraceId result) - { - if (s is { Length: 32 } && IsValidHex(s.AsSpan())) { result = new(s); return true; } - result = default; return false; - } - public bool TryFormat(Span dest, out int written, ReadOnlySpan format, IFormatProvider? provider) - { - if (dest.Length < 32 || string.IsNullOrEmpty(Value)) { written = 0; return false; } - Value.AsSpan().CopyTo(dest); written = 32; return true; - } - string IFormattable.ToString(string? format, IFormatProvider? provider) => Value ?? string.Empty; - static bool IsValidHex(ReadOnlySpan s) { foreach (var c in s) if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))) return false; return true; } -} - -file sealed class TraceIdJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override TraceId Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, TraceId value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// W3C Trace Context tracestate header (vendor-specific key-value pairs) -[System.Text.Json.Serialization.JsonConverter(typeof(TraceStateJsonConverter))] -public readonly partial record struct TraceState(string Value) -{ - public static implicit operator string(TraceState v) => v.Value; - public static implicit operator TraceState(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - public bool IsValid => !string.IsNullOrEmpty(Value); -} - -file sealed class TraceStateJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override TraceState Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, TraceState value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// URL string (absolute) -[System.Text.Json.Serialization.JsonConverter(typeof(UrlStringJsonConverter))] -public readonly partial record struct UrlString(string Value) -{ - public static implicit operator string(UrlString v) => v.Value; - public static implicit operator UrlString(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - public bool IsValid => !string.IsNullOrEmpty(Value); -} - -file sealed class UrlStringJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override UrlString Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, UrlString value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// User agent string -[System.Text.Json.Serialization.JsonConverter(typeof(UserAgentJsonConverter))] -public readonly partial record struct UserAgent(string Value) -{ - public static implicit operator string(UserAgent v) => v.Value; - public static implicit operator UserAgent(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - public bool IsValid => !string.IsNullOrEmpty(Value); -} - -file sealed class UserAgentJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override UserAgent Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, UserAgent value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - -/// User identifier (pseudonymized for privacy) -[System.Text.Json.Serialization.JsonConverter(typeof(UserIdJsonConverter))] -public readonly partial record struct UserId(string Value) -{ - public static implicit operator string(UserId v) => v.Value; - public static implicit operator UserId(string v) => new(v); - public override string ToString() => Value ?? string.Empty; - public bool IsValid => !string.IsNullOrEmpty(Value); -} - -file sealed class UserIdJsonConverter : System.Text.Json.Serialization.JsonConverter -{ - public override UserId Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) => new(reader.GetString() ?? string.Empty); - public override void Write(System.Text.Json.Utf8JsonWriter writer, UserId value, System.Text.Json.JsonSerializerOptions options) => writer.WriteStringValue(value.Value); -} - diff --git a/src/qyl.collector/Ingestion/OtlpAttributes.cs b/src/qyl.collector/Ingestion/OtlpAttributes.cs index eadd48f8d..820b8827f 100644 --- a/src/qyl.collector/Ingestion/OtlpAttributes.cs +++ b/src/qyl.collector/Ingestion/OtlpAttributes.cs @@ -12,7 +12,7 @@ namespace qyl.collector.Ingestion; /// OTel GenAI Semantic Conventions v1.39.0 - UTF-8 attribute keys for zero-allocation parsing. /// Uses direct StartsWith checks for prefix matching (NOT SearchValues which is for substring). /// -public static class OtlpGenAiAttributes +internal static class OtlpGenAiAttributes { // ========================================================================= // CORE ATTRIBUTES (Required/Conditionally Required) @@ -257,7 +257,7 @@ public static bool TryGetCurrentName(string deprecatedKey, [NotNullWhen(true)] o /// /// Well-known values for gen_ai.operation.name (OTel v1.39) /// -public static class GenAiOperationName +internal static class GenAiOperationName { public const string Chat = "chat"; public const string TextCompletion = "text_completion"; @@ -271,7 +271,7 @@ public static class GenAiOperationName /// /// Well-known values for gen_ai.output.type (OTel v1.39) /// -public static class GenAiOutputType +internal static class GenAiOutputType { public const string Text = "text"; public const string Json = "json"; @@ -282,7 +282,7 @@ public static class GenAiOutputType /// /// Well-known values for gen_ai.tool.type (OTel v1.39) /// -public static class GenAiToolType +internal static class GenAiToolType { public const string Function = "function"; public const string Extension = "extension"; @@ -292,7 +292,7 @@ public static class GenAiToolType /// /// Well-known values for gen_ai.token.type (OTel v1.39 metrics) /// -public static class GenAiTokenType +internal static class GenAiTokenType { public const string Input = "input"; public const string Output = "output"; @@ -301,7 +301,7 @@ public static class GenAiTokenType /// /// Well-known values for error.type /// -public static class ErrorType +internal static class ErrorType { public const string Other = "_OTHER"; } @@ -313,7 +313,7 @@ public static class ErrorType /// /// Semantic names for GenAI Events (structured logs). /// -public static class GenAiEventNames +internal static class GenAiEventNames { /// Event containing full input/output details for an inference operation. public const string OperationDetails = "gen_ai.client.inference.operation.details"; @@ -329,7 +329,7 @@ public static class GenAiEventNames /// /// Semantic names for GenAI Metrics. /// -public static class GenAiMetricNames +internal static class GenAiMetricNames { /// Histogram: Number of input and output tokens used. public const string TokenUsage = "gen_ai.client.token.usage"; @@ -351,7 +351,7 @@ public static class GenAiMetricNames /// /// Provider identifiers per OTel 1.39 gen_ai.provider.name values. /// -public static class OtlpGenAiProviders +internal static class OtlpGenAiProviders { // OTel v1.39 canonical provider names public const string Anthropic = "anthropic"; @@ -431,7 +431,7 @@ public static bool TryDetectFromHost(ReadOnlySpan host, [NotNullWhen(true) /// /// Single source of truth for deprecated OTel attribute mappings (1.39 migration). /// -public static class SchemaNormalizer +internal static class SchemaNormalizer { #pragma warning disable QYL0002 // Intentionally references deprecated attributes for migration /// @@ -501,28 +501,28 @@ public static bool TryGetCurrentName(string deprecatedKey, [NotNullWhen(true)] o // OTLP JSON DTOs // ============================================================================= -public sealed record OtlpExportTraceServiceRequest +internal sealed record OtlpExportTraceServiceRequest { public List? ResourceSpans { get; init; } } -public sealed record OtlpResourceSpans +internal sealed record OtlpResourceSpans { public OtlpResource? Resource { get; init; } public List? ScopeSpans { get; init; } } -public sealed record OtlpResource +internal sealed record OtlpResource { public List? Attributes { get; init; } } -public sealed record OtlpScopeSpans +internal sealed record OtlpScopeSpans { public List? Spans { get; init; } } -public sealed record OtlpSpan +internal sealed record OtlpSpan { public string? TraceId { get; init; } public string? SpanId { get; init; } @@ -540,19 +540,19 @@ public sealed record OtlpSpan public List? Attributes { get; init; } } -public sealed record OtlpStatus +internal sealed record OtlpStatus { public int? Code { get; init; } public string? Message { get; init; } } -public sealed record OtlpKeyValue +internal sealed record OtlpKeyValue { public string? Key { get; init; } public OtlpAnyValue? Value { get; init; } } -public sealed record OtlpAnyValue +internal sealed record OtlpAnyValue { public string? StringValue { get; init; } public long? IntValue { get; init; } @@ -567,7 +567,7 @@ public sealed record OtlpAnyValue /// /// Parsed span data with promoted GenAI attributes. /// -public sealed class ParsedSpan +internal sealed class ParsedSpan { public TraceId TraceId { get; set; } public SpanId SpanId { get; set; } @@ -621,7 +621,7 @@ public TimeSpan Duration /// /// OTel span kind enumeration. /// -public enum SpanKind : byte +internal enum SpanKind : byte { Unspecified = 0, Internal = 1, @@ -634,7 +634,7 @@ public enum SpanKind : byte /// /// OTel span status code enumeration. /// -public enum StatusCode : byte +internal enum StatusCode : byte { Unset = 0, Ok = 1, @@ -645,23 +645,23 @@ public enum StatusCode : byte // OTLP LOGS JSON DTOs // ============================================================================= -public sealed record OtlpExportLogsServiceRequest +internal sealed record OtlpExportLogsServiceRequest { public List? ResourceLogs { get; init; } } -public sealed record OtlpResourceLogs +internal sealed record OtlpResourceLogs { public OtlpResource? Resource { get; init; } public List? ScopeLogs { get; init; } } -public sealed record OtlpScopeLogs +internal sealed record OtlpScopeLogs { public List? LogRecords { get; init; } } -public sealed record OtlpLogRecord +internal sealed record OtlpLogRecord { public ulong TimeUnixNano { get; init; } public ulong ObservedTimeUnixNano { get; init; } diff --git a/src/qyl.collector/Ingestion/OtlpConverter.cs b/src/qyl.collector/Ingestion/OtlpConverter.cs index 8cbf94831..8e1424503 100644 --- a/src/qyl.collector/Ingestion/OtlpConverter.cs +++ b/src/qyl.collector/Ingestion/OtlpConverter.cs @@ -11,7 +11,7 @@ namespace qyl.collector.Ingestion; /// Converts OTLP protobuf/JSON to SpanStorageRow. /// Single source of truth for both gRPC (port 4317) and HTTP (POST /v1/traces) endpoints. /// -public static class OtlpConverter +internal static class OtlpConverter { #region Proto Conversion (gRPC endpoint) diff --git a/src/qyl.collector/Ingestion/OtlpJsonSpanParser.cs b/src/qyl.collector/Ingestion/OtlpJsonSpanParser.cs index ceb4020a1..d2bbcc919 100644 --- a/src/qyl.collector/Ingestion/OtlpJsonSpanParser.cs +++ b/src/qyl.collector/Ingestion/OtlpJsonSpanParser.cs @@ -11,7 +11,7 @@ namespace qyl.collector.Ingestion; /// High-performance OTLP/JSON span parser. Zero allocation on hot path. /// Designed for streaming ingestion via System.Threading.Channels. /// -public ref struct OtlpJsonSpanParser +internal ref struct OtlpJsonSpanParser { private Utf8JsonReader _reader; diff --git a/src/qyl.collector/Program.cs b/src/qyl.collector/Program.cs index fc1a9dd7f..9a87df626 100644 --- a/src/qyl.collector/Program.cs +++ b/src/qyl.collector/Program.cs @@ -1200,5 +1200,5 @@ public sealed record ErrorResponse(string Error, string? Message = null); [JsonSerializable(typeof(TraceFromMemoryResponse))] [JsonSerializable(typeof(SessionSpansFromMemoryResponse))] [JsonSerializable(typeof(BufferStatsResponse))] - public partial class QylSerializerContext : JsonSerializerContext; + internal partial class QylSerializerContext : JsonSerializerContext; } diff --git a/src/qyl.collector/qyl.collector.csproj b/src/qyl.collector/qyl.collector.csproj index 5f7a8bd5b..a3ad784bf 100644 --- a/src/qyl.collector/qyl.collector.csproj +++ b/src/qyl.collector/qyl.collector.csproj @@ -6,11 +6,16 @@ true 14 true - - - $(NoWarn);CA2007;VSTHRD111;NU1510 + + + $(NoWarn);CA2007;NU1510 + + + + + diff --git a/tests/qyl.collector.tests/Ingestion/OtlpJsonSpanParserTests.cs b/tests/qyl.collector.tests/Ingestion/OtlpJsonSpanParserTests.cs index 0e65263c5..3d82e16ec 100644 --- a/tests/qyl.collector.tests/Ingestion/OtlpJsonSpanParserTests.cs +++ b/tests/qyl.collector.tests/Ingestion/OtlpJsonSpanParserTests.cs @@ -12,13 +12,13 @@ public sealed class OtlpJsonSpanParserTests #region SpanKind Parsing Tests [Theory] - [InlineData(0, SpanKind.Unspecified)] - [InlineData(1, SpanKind.Internal)] - [InlineData(2, SpanKind.Server)] - [InlineData(3, SpanKind.Client)] - [InlineData(4, SpanKind.Producer)] - [InlineData(5, SpanKind.Consumer)] - public void Parse_SpanKind_MapsCorrectly(int kindValue, SpanKind expected) + [InlineData(0, 0)] // SpanKind.Unspecified + [InlineData(1, 1)] // SpanKind.Internal + [InlineData(2, 2)] // SpanKind.Server + [InlineData(3, 3)] // SpanKind.Client + [InlineData(4, 4)] // SpanKind.Producer + [InlineData(5, 5)] // SpanKind.Consumer + public void Parse_SpanKind_MapsCorrectly(int kindValue, int expectedKindValue) { // Arrange var json = Encoding.UTF8.GetBytes($$""" @@ -44,7 +44,7 @@ public void Parse_SpanKind_MapsCorrectly(int kindValue, SpanKind expected) // Assert Assert.Single(spans); - Assert.Equal(expected, spans[0].Kind); + Assert.Equal((SpanKind)expectedKindValue, spans[0].Kind); } #endregion