@gravito/echo 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -9
- package/dist/OrbitEcho.d.ts +76 -60
- package/dist/index.d.ts +31 -16
- package/dist/index.js +1 -1596
- package/dist/index.js.map +3 -28
- package/dist/{echo/src/middleware → middleware}/RequestBufferMiddleware.d.ts +3 -3
- package/dist/providers/GenericProvider.d.ts +37 -19
- package/dist/providers/GitHubProvider.d.ts +21 -13
- package/dist/providers/StripeProvider.d.ts +20 -13
- package/dist/providers/index.d.ts +14 -4
- package/dist/receive/SignatureValidator.d.ts +33 -1
- package/dist/receive/WebhookReceiver.d.ts +139 -22
- package/dist/receive/index.d.ts +0 -1
- package/dist/send/WebhookDispatcher.d.ts +159 -16
- package/dist/send/index.d.ts +0 -1
- package/dist/types.d.ts +669 -57
- package/package.json +5 -2
- package/dist/OrbitEcho.d.ts.map +0 -1
- package/dist/atlas/src/DB.d.ts +0 -348
- package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
- package/dist/atlas/src/config/defineConfig.d.ts +0 -14
- package/dist/atlas/src/config/index.d.ts +0 -7
- package/dist/atlas/src/config/loadConfig.d.ts +0 -41
- package/dist/atlas/src/connection/Connection.d.ts +0 -112
- package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -180
- package/dist/atlas/src/connection/ReplicaConnectionPool.d.ts +0 -54
- package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
- package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
- package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
- package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -79
- package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -96
- package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
- package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
- package/dist/atlas/src/drivers/types.d.ts +0 -260
- package/dist/atlas/src/errors/index.d.ts +0 -45
- package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
- package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
- package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
- package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
- package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
- package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
- package/dist/atlas/src/index.d.ts +0 -79
- package/dist/atlas/src/migration/Migration.d.ts +0 -64
- package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
- package/dist/atlas/src/migration/Migrator.d.ts +0 -110
- package/dist/atlas/src/migration/index.d.ts +0 -6
- package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -33
- package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
- package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
- package/dist/atlas/src/observability/index.d.ts +0 -9
- package/dist/atlas/src/orm/Repository.d.ts +0 -247
- package/dist/atlas/src/orm/index.d.ts +0 -6
- package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
- package/dist/atlas/src/orm/model/Model.d.ts +0 -458
- package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
- package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -150
- package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
- package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -92
- package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
- package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
- package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
- package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
- package/dist/atlas/src/orm/model/decorators.d.ts +0 -138
- package/dist/atlas/src/orm/model/errors.d.ts +0 -52
- package/dist/atlas/src/orm/model/index.d.ts +0 -10
- package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
- package/dist/atlas/src/orm/model/types.d.ts +0 -12
- package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -124
- package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
- package/dist/atlas/src/orm/schema/index.d.ts +0 -6
- package/dist/atlas/src/orm/schema/types.d.ts +0 -85
- package/dist/atlas/src/pool/AdaptivePoolManager.d.ts +0 -98
- package/dist/atlas/src/pool/PoolHealthChecker.d.ts +0 -91
- package/dist/atlas/src/pool/PoolStrategy.d.ts +0 -129
- package/dist/atlas/src/pool/PoolWarmer.d.ts +0 -92
- package/dist/atlas/src/query/Expression.d.ts +0 -60
- package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
- package/dist/atlas/src/query/QueryBuilder.d.ts +0 -643
- package/dist/atlas/src/query/RelationshipResolver.d.ts +0 -23
- package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
- package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
- package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
- package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
- package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
- package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
- package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
- package/dist/atlas/src/query/clauses/index.d.ts +0 -11
- package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
- package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
- package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
- package/dist/atlas/src/schema/MigrationGenerator.d.ts +0 -45
- package/dist/atlas/src/schema/Schema.d.ts +0 -131
- package/dist/atlas/src/schema/SchemaDiff.d.ts +0 -73
- package/dist/atlas/src/schema/TypeGenerator.d.ts +0 -57
- package/dist/atlas/src/schema/TypeWriter.d.ts +0 -42
- package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
- package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
- package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
- package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
- package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
- package/dist/atlas/src/schema/index.d.ts +0 -8
- package/dist/atlas/src/seed/Factory.d.ts +0 -90
- package/dist/atlas/src/seed/Seeder.d.ts +0 -28
- package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
- package/dist/atlas/src/seed/index.d.ts +0 -6
- package/dist/atlas/src/sharding/ShardingManager.d.ts +0 -59
- package/dist/atlas/src/types/index.d.ts +0 -1182
- package/dist/atlas/src/utils/CursorEncoding.d.ts +0 -63
- package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
- package/dist/core/src/Application.d.ts +0 -215
- package/dist/core/src/CommandKernel.d.ts +0 -33
- package/dist/core/src/ConfigManager.d.ts +0 -65
- package/dist/core/src/Container/RequestScopeManager.d.ts +0 -62
- package/dist/core/src/Container/RequestScopeMetrics.d.ts +0 -144
- package/dist/core/src/Container.d.ts +0 -153
- package/dist/core/src/ErrorHandler.d.ts +0 -66
- package/dist/core/src/Event.d.ts +0 -5
- package/dist/core/src/EventManager.d.ts +0 -123
- package/dist/core/src/GlobalErrorHandlers.d.ts +0 -47
- package/dist/core/src/GravitoServer.d.ts +0 -28
- package/dist/core/src/HookManager.d.ts +0 -591
- package/dist/core/src/Listener.d.ts +0 -4
- package/dist/core/src/Logger.d.ts +0 -20
- package/dist/core/src/PlanetCore.d.ts +0 -378
- package/dist/core/src/RequestContext.d.ts +0 -97
- package/dist/core/src/Route.d.ts +0 -36
- package/dist/core/src/Router.d.ts +0 -284
- package/dist/core/src/ServiceProvider.d.ts +0 -178
- package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +0 -27
- package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
- package/dist/core/src/adapters/bun/BunContext.d.ts +0 -49
- package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +0 -31
- package/dist/core/src/adapters/bun/BunRequest.d.ts +0 -31
- package/dist/core/src/adapters/bun/RadixNode.d.ts +0 -19
- package/dist/core/src/adapters/bun/RadixRouter.d.ts +0 -31
- package/dist/core/src/adapters/bun/types.d.ts +0 -20
- package/dist/core/src/adapters/photon-types.d.ts +0 -73
- package/dist/core/src/adapters/types.d.ts +0 -235
- package/dist/core/src/cli/queue-commands.d.ts +0 -6
- package/dist/core/src/engine/AOTRouter.d.ts +0 -129
- package/dist/core/src/engine/FastContext.d.ts +0 -123
- package/dist/core/src/engine/Gravito.d.ts +0 -136
- package/dist/core/src/engine/MinimalContext.d.ts +0 -100
- package/dist/core/src/engine/analyzer.d.ts +0 -27
- package/dist/core/src/engine/constants.d.ts +0 -23
- package/dist/core/src/engine/index.d.ts +0 -26
- package/dist/core/src/engine/path.d.ts +0 -26
- package/dist/core/src/engine/pool.d.ts +0 -83
- package/dist/core/src/engine/types.d.ts +0 -146
- package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +0 -126
- package/dist/core/src/events/BackpressureManager.d.ts +0 -215
- package/dist/core/src/events/CircuitBreaker.d.ts +0 -229
- package/dist/core/src/events/DeadLetterQueue.d.ts +0 -219
- package/dist/core/src/events/EventBackend.d.ts +0 -12
- package/dist/core/src/events/EventOptions.d.ts +0 -204
- package/dist/core/src/events/EventPriorityQueue.d.ts +0 -301
- package/dist/core/src/events/FlowControlStrategy.d.ts +0 -109
- package/dist/core/src/events/IdempotencyCache.d.ts +0 -60
- package/dist/core/src/events/MessageQueueBridge.d.ts +0 -184
- package/dist/core/src/events/PriorityEscalationManager.d.ts +0 -82
- package/dist/core/src/events/RetryScheduler.d.ts +0 -104
- package/dist/core/src/events/WorkerPool.d.ts +0 -98
- package/dist/core/src/events/WorkerPoolConfig.d.ts +0 -153
- package/dist/core/src/events/WorkerPoolMetrics.d.ts +0 -65
- package/dist/core/src/events/aggregation/AggregationWindow.d.ts +0 -77
- package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +0 -135
- package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +0 -108
- package/dist/core/src/events/aggregation/EventBatcher.d.ts +0 -99
- package/dist/core/src/events/aggregation/types.d.ts +0 -117
- package/dist/core/src/events/index.d.ts +0 -25
- package/dist/core/src/events/observability/EventMetrics.d.ts +0 -132
- package/dist/core/src/events/observability/EventTracer.d.ts +0 -68
- package/dist/core/src/events/observability/EventTracing.d.ts +0 -161
- package/dist/core/src/events/observability/OTelEventMetrics.d.ts +0 -332
- package/dist/core/src/events/observability/ObservableHookManager.d.ts +0 -108
- package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +0 -76
- package/dist/core/src/events/observability/index.d.ts +0 -24
- package/dist/core/src/events/observability/metrics-types.d.ts +0 -16
- package/dist/core/src/events/types.d.ts +0 -134
- package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -8
- package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -8
- package/dist/core/src/exceptions/CircularDependencyException.d.ts +0 -9
- package/dist/core/src/exceptions/GravitoException.d.ts +0 -23
- package/dist/core/src/exceptions/HttpException.d.ts +0 -9
- package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -10
- package/dist/core/src/exceptions/ValidationException.d.ts +0 -22
- package/dist/core/src/exceptions/index.d.ts +0 -7
- package/dist/core/src/health/HealthProvider.d.ts +0 -67
- package/dist/core/src/helpers/Arr.d.ts +0 -19
- package/dist/core/src/helpers/Str.d.ts +0 -23
- package/dist/core/src/helpers/data.d.ts +0 -25
- package/dist/core/src/helpers/errors.d.ts +0 -34
- package/dist/core/src/helpers/response.d.ts +0 -41
- package/dist/core/src/helpers.d.ts +0 -338
- package/dist/core/src/http/CookieJar.d.ts +0 -51
- package/dist/core/src/http/cookie.d.ts +0 -29
- package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
- package/dist/core/src/http/middleware/Cors.d.ts +0 -24
- package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
- package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
- package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
- package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
- package/dist/core/src/http/types.d.ts +0 -374
- package/dist/core/src/index.d.ts +0 -88
- package/dist/core/src/instrumentation/index.d.ts +0 -35
- package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
- package/dist/core/src/instrumentation/types.d.ts +0 -182
- package/dist/core/src/observability/Metrics.d.ts +0 -244
- package/dist/core/src/observability/QueueDashboard.d.ts +0 -136
- package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +0 -350
- package/dist/core/src/reliability/RetryPolicy.d.ts +0 -217
- package/dist/core/src/reliability/index.d.ts +0 -6
- package/dist/core/src/router/ControllerDispatcher.d.ts +0 -12
- package/dist/core/src/router/RequestValidator.d.ts +0 -20
- package/dist/core/src/runtime.d.ts +0 -119
- package/dist/core/src/security/Encrypter.d.ts +0 -33
- package/dist/core/src/security/Hasher.d.ts +0 -29
- package/dist/core/src/testing/HttpTester.d.ts +0 -39
- package/dist/core/src/testing/TestResponse.d.ts +0 -78
- package/dist/core/src/testing/index.d.ts +0 -2
- package/dist/core/src/types/events.d.ts +0 -94
- package/dist/echo/src/OrbitEcho.d.ts +0 -115
- package/dist/echo/src/index.d.ts +0 -64
- package/dist/echo/src/providers/GenericProvider.d.ts +0 -53
- package/dist/echo/src/providers/GitHubProvider.d.ts +0 -35
- package/dist/echo/src/providers/StripeProvider.d.ts +0 -38
- package/dist/echo/src/providers/index.d.ts +0 -14
- package/dist/echo/src/receive/SignatureValidator.d.ts +0 -67
- package/dist/echo/src/receive/WebhookReceiver.d.ts +0 -185
- package/dist/echo/src/receive/index.d.ts +0 -2
- package/dist/echo/src/send/WebhookDispatcher.d.ts +0 -198
- package/dist/echo/src/send/index.d.ts +0 -1
- package/dist/echo/src/types.d.ts +0 -756
- package/dist/index.d.ts.map +0 -1
- package/dist/monitor/src/MonitorOrbit.d.ts +0 -43
- package/dist/monitor/src/config.d.ts +0 -106
- package/dist/monitor/src/health/HealthController.d.ts +0 -28
- package/dist/monitor/src/health/HealthRegistry.d.ts +0 -80
- package/dist/monitor/src/health/index.d.ts +0 -36
- package/dist/monitor/src/index.d.ts +0 -13
- package/dist/monitor/src/metrics/MetricsController.d.ts +0 -22
- package/dist/monitor/src/metrics/MetricsRegistry.d.ts +0 -136
- package/dist/monitor/src/metrics/index.d.ts +0 -11
- package/dist/monitor/src/tracing/TracingManager.d.ts +0 -97
- package/dist/monitor/src/tracing/index.d.ts +0 -10
- package/dist/photon/src/index.d.ts +0 -89
- package/dist/photon/src/middleware/binary.d.ts +0 -31
- package/dist/photon/src/middleware/htmx.d.ts +0 -39
- package/dist/photon/src/middleware/ratelimit-redis.d.ts +0 -50
- package/dist/photon/src/middleware/ratelimit.d.ts +0 -161
- package/dist/photon/src/openapi.d.ts +0 -19
- package/dist/providers/GenericProvider.d.ts.map +0 -1
- package/dist/providers/GitHubProvider.d.ts.map +0 -1
- package/dist/providers/StripeProvider.d.ts.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/receive/SignatureValidator.d.ts.map +0 -1
- package/dist/receive/WebhookReceiver.d.ts.map +0 -1
- package/dist/receive/index.d.ts.map +0 -1
- package/dist/send/WebhookDispatcher.d.ts.map +0 -1
- package/dist/send/index.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- /package/dist/{echo/src/dlq → dlq}/DeadLetterQueue.d.ts +0 -0
- /package/dist/{echo/src/dlq → dlq}/MemoryDeadLetterQueue.d.ts +0 -0
- /package/dist/{echo/src/dlq → dlq}/index.d.ts +0 -0
- /package/dist/{echo/src/middleware → middleware}/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/logging/ConsoleEchoLogger.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/logging/EchoLogger.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/logging/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/MetricsProvider.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/NoopMetricsProvider.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/PrometheusMetricsProvider.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/tracing/NoopTracer.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/tracing/Tracer.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/tracing/index.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/LinearProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/PaddleProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/ShopifyProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/SlackProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/TwilioProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/base/BaseProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/base/HeaderUtils.d.ts +0 -0
- /package/dist/{echo/src/replay → replay}/WebhookReplayService.d.ts +0 -0
- /package/dist/{echo/src/replay → replay}/index.d.ts +0 -0
- /package/dist/{echo/src/resilience → resilience}/CircuitBreaker.d.ts +0 -0
- /package/dist/{echo/src/resilience → resilience}/index.d.ts +0 -0
- /package/dist/{echo/src/rotation → rotation}/KeyRotationManager.d.ts +0 -0
- /package/dist/{echo/src/rotation → rotation}/index.d.ts +0 -0
- /package/dist/{echo/src/storage → storage}/MemoryWebhookStore.d.ts +0 -0
- /package/dist/{echo/src/storage → storage}/WebhookStore.d.ts +0 -0
- /package/dist/{echo/src/storage → storage}/index.d.ts +0 -0
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAG5D,YAAY,EAEV,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,cAAc,EAEd,cAAc,EAEd,eAAe,EACf,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,SAAS,CAAA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - MonitorOrbit Plugin
|
|
3
|
-
*
|
|
4
|
-
* Gravito Orbit plugin for observability (Health, Metrics, Tracing)
|
|
5
|
-
*/
|
|
6
|
-
import type { GravitoOrbit, PlanetCore } from '@gravito/core';
|
|
7
|
-
import type { MonitorConfig } from './config';
|
|
8
|
-
import { HealthRegistry } from './health';
|
|
9
|
-
import { MetricsRegistry } from './metrics';
|
|
10
|
-
import { TracingManager } from './tracing';
|
|
11
|
-
/**
|
|
12
|
-
* Monitor service container
|
|
13
|
-
*/
|
|
14
|
-
export interface MonitorService {
|
|
15
|
-
health: HealthRegistry;
|
|
16
|
-
metrics: MetricsRegistry;
|
|
17
|
-
tracing: TracingManager;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* MonitorOrbit - Observability plugin for Gravito
|
|
21
|
-
*/
|
|
22
|
-
export declare class MonitorOrbit implements GravitoOrbit {
|
|
23
|
-
readonly name = "monitor";
|
|
24
|
-
private userConfig;
|
|
25
|
-
private healthRegistry;
|
|
26
|
-
private metricsRegistry;
|
|
27
|
-
private tracingManager;
|
|
28
|
-
constructor(config?: MonitorConfig);
|
|
29
|
-
/**
|
|
30
|
-
* Install the orbit (required by GravitoOrbit interface)
|
|
31
|
-
*/
|
|
32
|
-
install(core: PlanetCore): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* 註冊 health cache metrics
|
|
35
|
-
*
|
|
36
|
-
* 建立 metrics 來追蹤 health check cache 的效能
|
|
37
|
-
*/
|
|
38
|
-
private registerHealthCacheMetrics;
|
|
39
|
-
/**
|
|
40
|
-
* Shutdown hook
|
|
41
|
-
*/
|
|
42
|
-
shutdown(): Promise<void>;
|
|
43
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Configuration Types
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Health check result
|
|
6
|
-
*/
|
|
7
|
-
export interface HealthCheckResult {
|
|
8
|
-
status: 'healthy' | 'unhealthy' | 'degraded';
|
|
9
|
-
message?: string;
|
|
10
|
-
latency?: number;
|
|
11
|
-
details?: Record<string, unknown>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Health check function signature
|
|
15
|
-
*/
|
|
16
|
-
export type HealthCheckFn = () => Promise<HealthCheckResult> | HealthCheckResult;
|
|
17
|
-
/**
|
|
18
|
-
* Health configuration
|
|
19
|
-
*/
|
|
20
|
-
export interface HealthConfig {
|
|
21
|
-
/** Enable health endpoints (default: true) */
|
|
22
|
-
enabled?: boolean;
|
|
23
|
-
/** Path for full health check (default: /health) */
|
|
24
|
-
path?: string;
|
|
25
|
-
/** Path for Kubernetes readiness probe (default: /ready) */
|
|
26
|
-
readyPath?: string;
|
|
27
|
-
/** Path for Kubernetes liveness probe (default: /live) */
|
|
28
|
-
livePath?: string;
|
|
29
|
-
/** Timeout for individual health checks in ms (default: 5000) */
|
|
30
|
-
timeout?: number;
|
|
31
|
-
/** Cache health check results for ms (default: 0 = no cache) */
|
|
32
|
-
cacheTtl?: number;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Metric types
|
|
36
|
-
*/
|
|
37
|
-
export type MetricType = 'counter' | 'gauge' | 'histogram' | 'summary';
|
|
38
|
-
/**
|
|
39
|
-
* Metric definition options
|
|
40
|
-
*/
|
|
41
|
-
export interface MetricOptions {
|
|
42
|
-
name: string;
|
|
43
|
-
help: string;
|
|
44
|
-
labels?: string[];
|
|
45
|
-
buckets?: number[];
|
|
46
|
-
percentiles?: number[];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Metrics configuration
|
|
50
|
-
*/
|
|
51
|
-
export interface MetricsConfig {
|
|
52
|
-
/** Enable metrics endpoint (default: true) */
|
|
53
|
-
enabled?: boolean;
|
|
54
|
-
/** Path for metrics endpoint (default: /metrics) */
|
|
55
|
-
path?: string;
|
|
56
|
-
/** Collect default runtime metrics (default: true) */
|
|
57
|
-
defaultMetrics?: boolean;
|
|
58
|
-
/** Prefix for all metric names (default: gravito_) */
|
|
59
|
-
prefix?: string;
|
|
60
|
-
/** Custom labels to add to all metrics */
|
|
61
|
-
defaultLabels?: Record<string, string>;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Tracing configuration
|
|
65
|
-
*/
|
|
66
|
-
export interface TracingConfig {
|
|
67
|
-
/** Enable tracing (default: false) */
|
|
68
|
-
enabled?: boolean;
|
|
69
|
-
/** Service name for tracing */
|
|
70
|
-
serviceName?: string;
|
|
71
|
-
/** Service version */
|
|
72
|
-
serviceVersion?: string;
|
|
73
|
-
/** OTLP endpoint URL (default: http://localhost:4318/v1/traces) */
|
|
74
|
-
endpoint?: string;
|
|
75
|
-
/** Sample rate 0.0 - 1.0 (default: 1.0) */
|
|
76
|
-
sampleRate?: number;
|
|
77
|
-
/** Additional resource attributes */
|
|
78
|
-
resourceAttributes?: Record<string, string>;
|
|
79
|
-
/** Trace HTTP requests automatically (default: true) */
|
|
80
|
-
traceHttp?: boolean;
|
|
81
|
-
/** Headers to propagate in traces */
|
|
82
|
-
propagateHeaders?: string[];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Monitor configuration
|
|
86
|
-
*/
|
|
87
|
-
export interface MonitorConfig {
|
|
88
|
-
/** Health check configuration */
|
|
89
|
-
health?: HealthConfig;
|
|
90
|
-
/** Metrics configuration */
|
|
91
|
-
metrics?: MetricsConfig;
|
|
92
|
-
/** Tracing configuration */
|
|
93
|
-
tracing?: TracingConfig;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Default configuration values
|
|
97
|
-
*/
|
|
98
|
-
export declare const defaultConfig: Required<MonitorConfig>;
|
|
99
|
-
/**
|
|
100
|
-
* Helper to merge config with defaults
|
|
101
|
-
*/
|
|
102
|
-
export declare function resolveConfig(config: MonitorConfig): Required<MonitorConfig>;
|
|
103
|
-
/**
|
|
104
|
-
* Define monitor configuration (type helper)
|
|
105
|
-
*/
|
|
106
|
-
export declare function defineMonitorConfig(config: MonitorConfig): MonitorConfig;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Health Controller
|
|
3
|
-
*
|
|
4
|
-
* HTTP handlers for health check endpoints
|
|
5
|
-
*/
|
|
6
|
-
import type { GravitoContext } from '@gravito/core';
|
|
7
|
-
import type { HealthRegistry } from './HealthRegistry';
|
|
8
|
-
/**
|
|
9
|
-
* HealthController handles health check HTTP endpoints
|
|
10
|
-
*/
|
|
11
|
-
export declare class HealthController {
|
|
12
|
-
private registry;
|
|
13
|
-
constructor(registry: HealthRegistry);
|
|
14
|
-
/**
|
|
15
|
-
* GET /health - Full health check with all registered checks
|
|
16
|
-
*/
|
|
17
|
-
health(c: GravitoContext): Promise<Response>;
|
|
18
|
-
/**
|
|
19
|
-
* GET /ready - Kubernetes readiness probe
|
|
20
|
-
* Returns 200 if ready to serve traffic, 503 otherwise
|
|
21
|
-
*/
|
|
22
|
-
ready(c: GravitoContext): Promise<Response>;
|
|
23
|
-
/**
|
|
24
|
-
* GET /live - Kubernetes liveness probe
|
|
25
|
-
* Returns 200 if the process is alive
|
|
26
|
-
*/
|
|
27
|
-
live(c: GravitoContext): Promise<Response>;
|
|
28
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Health Check Registry
|
|
3
|
-
*
|
|
4
|
-
* Manages health check registrations and executions
|
|
5
|
-
*/
|
|
6
|
-
import type { HealthCheckFn, HealthCheckResult, HealthConfig } from '../config';
|
|
7
|
-
/**
|
|
8
|
-
* Aggregated health check report.
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export interface HealthReport {
|
|
12
|
-
status: 'healthy' | 'unhealthy' | 'degraded';
|
|
13
|
-
timestamp: string;
|
|
14
|
-
uptime: number;
|
|
15
|
-
checks: Record<string, HealthCheckResult & {
|
|
16
|
-
name: string;
|
|
17
|
-
}>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Cache statistics
|
|
21
|
-
*/
|
|
22
|
-
export interface CacheStats {
|
|
23
|
-
hits: number;
|
|
24
|
-
misses: number;
|
|
25
|
-
hitRate: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* HealthRegistry manages all health checks
|
|
29
|
-
*/
|
|
30
|
-
export declare class HealthRegistry {
|
|
31
|
-
private checks;
|
|
32
|
-
private startTime;
|
|
33
|
-
private cachedReport;
|
|
34
|
-
private cacheExpiry;
|
|
35
|
-
private timeout;
|
|
36
|
-
private cacheTtl;
|
|
37
|
-
private cacheHits;
|
|
38
|
-
private cacheMisses;
|
|
39
|
-
constructor(config?: HealthConfig);
|
|
40
|
-
/**
|
|
41
|
-
* Register a health check
|
|
42
|
-
*/
|
|
43
|
-
register(name: string, check: HealthCheckFn): this;
|
|
44
|
-
/**
|
|
45
|
-
* Unregister a health check
|
|
46
|
-
*/
|
|
47
|
-
unregister(name: string): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Get all registered check names
|
|
50
|
-
*/
|
|
51
|
-
getCheckNames(): string[];
|
|
52
|
-
/**
|
|
53
|
-
* Execute a single health check with timeout
|
|
54
|
-
*/
|
|
55
|
-
private executeCheck;
|
|
56
|
-
/**
|
|
57
|
-
* Execute all health checks and generate report
|
|
58
|
-
*/
|
|
59
|
-
check(): Promise<HealthReport>;
|
|
60
|
-
/**
|
|
61
|
-
* Simple liveness check (is the process running?)
|
|
62
|
-
*/
|
|
63
|
-
liveness(): Promise<{
|
|
64
|
-
status: 'healthy' | 'unhealthy';
|
|
65
|
-
}>;
|
|
66
|
-
/**
|
|
67
|
-
* Readiness check (is the app ready to serve traffic?)
|
|
68
|
-
* By default, requires all checks to be healthy
|
|
69
|
-
*/
|
|
70
|
-
readiness(): Promise<{
|
|
71
|
-
status: 'healthy' | 'unhealthy';
|
|
72
|
-
reason?: string;
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Get cache statistics
|
|
76
|
-
*
|
|
77
|
-
* Useful for monitoring cache effectiveness and tuning cacheTtl
|
|
78
|
-
*/
|
|
79
|
-
getCacheStats(): CacheStats;
|
|
80
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Built-in Health Checks
|
|
3
|
-
*/
|
|
4
|
-
import type { HealthCheckFn } from '../config';
|
|
5
|
-
export type { CacheStats, HealthReport } from './HealthRegistry';
|
|
6
|
-
/**
|
|
7
|
-
* Create a database health check
|
|
8
|
-
*/
|
|
9
|
-
export declare function createDatabaseCheck(connectionFn: () => Promise<boolean> | boolean): HealthCheckFn;
|
|
10
|
-
/**
|
|
11
|
-
* Create a Redis health check
|
|
12
|
-
*/
|
|
13
|
-
export declare function createRedisCheck(pingFn: () => Promise<string> | string): HealthCheckFn;
|
|
14
|
-
/**
|
|
15
|
-
* Create a memory usage health check
|
|
16
|
-
*/
|
|
17
|
-
export declare function createMemoryCheck(options?: {
|
|
18
|
-
maxHeapUsedPercent?: number;
|
|
19
|
-
}): HealthCheckFn;
|
|
20
|
-
/**
|
|
21
|
-
* Create a custom HTTP endpoint health check
|
|
22
|
-
*/
|
|
23
|
-
export declare function createHttpCheck(url: string, options?: {
|
|
24
|
-
timeout?: number;
|
|
25
|
-
expectedStatus?: number;
|
|
26
|
-
method?: string;
|
|
27
|
-
}): HealthCheckFn;
|
|
28
|
-
/**
|
|
29
|
-
* Create a disk space health check
|
|
30
|
-
*/
|
|
31
|
-
export declare function createDiskCheck(options?: {
|
|
32
|
-
path?: string;
|
|
33
|
-
minFreePercent?: number;
|
|
34
|
-
}): HealthCheckFn;
|
|
35
|
-
export { HealthController } from './HealthController';
|
|
36
|
-
export { HealthRegistry } from './HealthRegistry';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor
|
|
3
|
-
*
|
|
4
|
-
* Observability module for Gravito
|
|
5
|
-
* - Health Checks (Kubernetes probes)
|
|
6
|
-
* - Metrics (Prometheus format)
|
|
7
|
-
* - Tracing (OpenTelemetry OTLP)
|
|
8
|
-
*/
|
|
9
|
-
export { defineMonitorConfig, type HealthCheckFn, type HealthCheckResult, type HealthConfig, type MetricOptions, type MetricsConfig, type MonitorConfig, type TracingConfig, } from './config';
|
|
10
|
-
export { createDatabaseCheck, createDiskCheck, createHttpCheck, createMemoryCheck, createRedisCheck, HealthController, HealthRegistry, type HealthReport, } from './health';
|
|
11
|
-
export { MonitorOrbit, type MonitorService } from './MonitorOrbit';
|
|
12
|
-
export { Counter, createHttpMetricsMiddleware, Gauge, Histogram, MetricsController, MetricsRegistry, } from './metrics';
|
|
13
|
-
export { createTracingMiddleware, type Span, type SpanContext, type SpanEvent, TracingManager, } from './tracing';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Metrics Controller
|
|
3
|
-
*/
|
|
4
|
-
import type { GravitoContext } from '@gravito/core';
|
|
5
|
-
import type { MetricsRegistry } from './MetricsRegistry';
|
|
6
|
-
/**
|
|
7
|
-
* MetricsController handles the /metrics endpoint
|
|
8
|
-
*/
|
|
9
|
-
export declare class MetricsController {
|
|
10
|
-
private registry;
|
|
11
|
-
constructor(registry: MetricsRegistry);
|
|
12
|
-
/**
|
|
13
|
-
* GET /metrics - Prometheus metrics endpoint
|
|
14
|
-
*/
|
|
15
|
-
metrics(_c: GravitoContext): Promise<Response>;
|
|
16
|
-
/**
|
|
17
|
-
* 更新 health cache metrics
|
|
18
|
-
*
|
|
19
|
-
* 從 HealthRegistry 讀取最新的 cache 統計並更新 gauges
|
|
20
|
-
*/
|
|
21
|
-
private updateHealthCacheMetrics;
|
|
22
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Metrics Registry
|
|
3
|
-
*
|
|
4
|
-
* Manages metric collection and Prometheus exposition
|
|
5
|
-
*/
|
|
6
|
-
import type { MetricOptions, MetricsConfig } from '../config';
|
|
7
|
-
/**
|
|
8
|
-
* Represents a single metric data point with labels.
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export interface MetricValue {
|
|
12
|
-
value: number;
|
|
13
|
-
labels: Record<string, string>;
|
|
14
|
-
timestamp?: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Counter metric - monotonically increasing value
|
|
18
|
-
*/
|
|
19
|
-
export declare class Counter {
|
|
20
|
-
readonly name: string;
|
|
21
|
-
readonly help: string;
|
|
22
|
-
readonly labelNames: string[];
|
|
23
|
-
private values;
|
|
24
|
-
constructor(name: string, help: string, labelNames?: string[]);
|
|
25
|
-
/**
|
|
26
|
-
* Increment the counter
|
|
27
|
-
*/
|
|
28
|
-
inc(labels?: Record<string, string>, delta?: number): void;
|
|
29
|
-
/**
|
|
30
|
-
* Get current values
|
|
31
|
-
*/
|
|
32
|
-
getValues(): MetricValue[];
|
|
33
|
-
/**
|
|
34
|
-
* Reset all values
|
|
35
|
-
*/
|
|
36
|
-
reset(): void;
|
|
37
|
-
private labelsToKey;
|
|
38
|
-
private keyToLabels;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Gauge metric - value that can go up or down
|
|
42
|
-
*/
|
|
43
|
-
export declare class Gauge {
|
|
44
|
-
readonly name: string;
|
|
45
|
-
readonly help: string;
|
|
46
|
-
readonly labelNames: string[];
|
|
47
|
-
private values;
|
|
48
|
-
constructor(name: string, help: string, labelNames?: string[]);
|
|
49
|
-
/**
|
|
50
|
-
* Set the gauge value
|
|
51
|
-
*/
|
|
52
|
-
set(value: number, labels?: Record<string, string>): void;
|
|
53
|
-
/**
|
|
54
|
-
* Increment the gauge
|
|
55
|
-
*/
|
|
56
|
-
inc(labels?: Record<string, string>, delta?: number): void;
|
|
57
|
-
/**
|
|
58
|
-
* Decrement the gauge
|
|
59
|
-
*/
|
|
60
|
-
dec(labels?: Record<string, string>, delta?: number): void;
|
|
61
|
-
/**
|
|
62
|
-
* Get current values
|
|
63
|
-
*/
|
|
64
|
-
getValues(): MetricValue[];
|
|
65
|
-
private labelsToKey;
|
|
66
|
-
private keyToLabels;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Histogram metric - tracks distribution of values
|
|
70
|
-
*/
|
|
71
|
-
export declare class Histogram {
|
|
72
|
-
readonly name: string;
|
|
73
|
-
readonly help: string;
|
|
74
|
-
readonly labelNames: string[];
|
|
75
|
-
private bucketCounts;
|
|
76
|
-
private sums;
|
|
77
|
-
private counts;
|
|
78
|
-
readonly buckets: number[];
|
|
79
|
-
constructor(name: string, help: string, labelNames?: string[], buckets?: number[]);
|
|
80
|
-
/**
|
|
81
|
-
* Observe a value
|
|
82
|
-
*/
|
|
83
|
-
observe(value: number, labels?: Record<string, string>): void;
|
|
84
|
-
/**
|
|
85
|
-
* Start a timer and return a function to stop it
|
|
86
|
-
*/
|
|
87
|
-
startTimer(labels?: Record<string, string>): () => void;
|
|
88
|
-
/**
|
|
89
|
-
* Get values for Prometheus format
|
|
90
|
-
*/
|
|
91
|
-
getValues(): {
|
|
92
|
-
buckets: Map<string, Map<number, number>>;
|
|
93
|
-
sums: Map<string, number>;
|
|
94
|
-
counts: Map<string, number>;
|
|
95
|
-
};
|
|
96
|
-
private labelsToKey;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* MetricsRegistry manages all metrics
|
|
100
|
-
*/
|
|
101
|
-
export declare class MetricsRegistry {
|
|
102
|
-
private counters;
|
|
103
|
-
private gauges;
|
|
104
|
-
private histograms;
|
|
105
|
-
private startTime;
|
|
106
|
-
private prefix;
|
|
107
|
-
private defaultLabels;
|
|
108
|
-
private collectDefaultMetrics;
|
|
109
|
-
constructor(config?: MetricsConfig);
|
|
110
|
-
/**
|
|
111
|
-
* Create or get a counter
|
|
112
|
-
*/
|
|
113
|
-
counter(options: MetricOptions): Counter;
|
|
114
|
-
/**
|
|
115
|
-
* Create or get a gauge
|
|
116
|
-
*/
|
|
117
|
-
gauge(options: MetricOptions): Gauge;
|
|
118
|
-
/**
|
|
119
|
-
* Create or get a histogram
|
|
120
|
-
*/
|
|
121
|
-
histogram(options: MetricOptions): Histogram;
|
|
122
|
-
/**
|
|
123
|
-
* Initialize default runtime metrics
|
|
124
|
-
*/
|
|
125
|
-
private initDefaultMetrics;
|
|
126
|
-
/**
|
|
127
|
-
* Update default metrics with current values
|
|
128
|
-
*/
|
|
129
|
-
private updateDefaultMetrics;
|
|
130
|
-
/**
|
|
131
|
-
* Export metrics in Prometheus format
|
|
132
|
-
*/
|
|
133
|
-
toPrometheus(): string;
|
|
134
|
-
private formatLabels;
|
|
135
|
-
private keyToLabels;
|
|
136
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - HTTP Metrics Middleware
|
|
3
|
-
*/
|
|
4
|
-
import type { GravitoContext } from '@gravito/core';
|
|
5
|
-
import type { MetricsRegistry } from './MetricsRegistry';
|
|
6
|
-
/**
|
|
7
|
-
* Create middleware that collects HTTP metrics
|
|
8
|
-
*/
|
|
9
|
-
export declare function createHttpMetricsMiddleware(registry: MetricsRegistry): (c: GravitoContext, next: () => Promise<void>) => Promise<Response | undefined>;
|
|
10
|
-
export { MetricsController } from './MetricsController';
|
|
11
|
-
export { Counter, Gauge, Histogram, MetricsRegistry } from './MetricsRegistry';
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Tracing Manager
|
|
3
|
-
*
|
|
4
|
-
* OpenTelemetry OTLP tracing integration
|
|
5
|
-
*/
|
|
6
|
-
import type { TracingConfig } from '../config';
|
|
7
|
-
/**
|
|
8
|
-
* Span interface for tracing
|
|
9
|
-
*/
|
|
10
|
-
export interface Span {
|
|
11
|
-
name: string;
|
|
12
|
-
traceId: string;
|
|
13
|
-
spanId: string;
|
|
14
|
-
parentSpanId?: string;
|
|
15
|
-
startTime: number;
|
|
16
|
-
endTime?: number;
|
|
17
|
-
attributes: Record<string, string | number | boolean>;
|
|
18
|
-
status: 'ok' | 'error' | 'unset';
|
|
19
|
-
events: SpanEvent[];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Event recorded within a span.
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export interface SpanEvent {
|
|
26
|
-
name: string;
|
|
27
|
-
timestamp: number;
|
|
28
|
-
attributes?: Record<string, string | number | boolean>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Span context for propagation
|
|
32
|
-
*/
|
|
33
|
-
export interface SpanContext {
|
|
34
|
-
traceId: string;
|
|
35
|
-
spanId: string;
|
|
36
|
-
traceFlags: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* TracingManager handles distributed tracing
|
|
40
|
-
*/
|
|
41
|
-
export declare class TracingManager {
|
|
42
|
-
private otelSdk;
|
|
43
|
-
private spans;
|
|
44
|
-
private isInitialized;
|
|
45
|
-
private serviceName;
|
|
46
|
-
private serviceVersion;
|
|
47
|
-
private endpoint;
|
|
48
|
-
private resourceAttributes;
|
|
49
|
-
constructor(config?: TracingConfig);
|
|
50
|
-
/**
|
|
51
|
-
* Initialize OpenTelemetry SDK if available
|
|
52
|
-
*/
|
|
53
|
-
initialize(): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Shutdown tracing
|
|
56
|
-
*/
|
|
57
|
-
shutdown(): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Start a new span
|
|
60
|
-
*/
|
|
61
|
-
startSpan(name: string, options?: {
|
|
62
|
-
attributes?: Record<string, string | number | boolean>;
|
|
63
|
-
parentSpan?: Span;
|
|
64
|
-
}): Span;
|
|
65
|
-
/**
|
|
66
|
-
* End a span
|
|
67
|
-
*/
|
|
68
|
-
endSpan(span: Span, status?: 'ok' | 'error'): void;
|
|
69
|
-
/**
|
|
70
|
-
* Add an event to a span
|
|
71
|
-
*/
|
|
72
|
-
addEvent(span: Span, name: string, attributes?: Record<string, string | number | boolean>): void;
|
|
73
|
-
/**
|
|
74
|
-
* Set span attribute
|
|
75
|
-
*/
|
|
76
|
-
setAttribute(span: Span, key: string, value: string | number | boolean): void;
|
|
77
|
-
/**
|
|
78
|
-
* Get the currently active span
|
|
79
|
-
*/
|
|
80
|
-
getActiveSpan(): Span | null;
|
|
81
|
-
/**
|
|
82
|
-
* Extract trace context from headers
|
|
83
|
-
*/
|
|
84
|
-
extractContext(headers: Headers): SpanContext | null;
|
|
85
|
-
/**
|
|
86
|
-
* Inject trace context into headers
|
|
87
|
-
*/
|
|
88
|
-
injectContext(headers: Headers, span: Span): void;
|
|
89
|
-
/**
|
|
90
|
-
* Get all collected spans (for debugging)
|
|
91
|
-
*/
|
|
92
|
-
getSpans(): Span[];
|
|
93
|
-
/**
|
|
94
|
-
* Clear collected spans
|
|
95
|
-
*/
|
|
96
|
-
clearSpans(): void;
|
|
97
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/monitor - Tracing Middleware
|
|
3
|
-
*/
|
|
4
|
-
import type { GravitoContext } from '@gravito/core';
|
|
5
|
-
import type { TracingManager } from './TracingManager';
|
|
6
|
-
/**
|
|
7
|
-
* Create middleware that traces HTTP requests
|
|
8
|
-
*/
|
|
9
|
-
export declare function createTracingMiddleware(tracer: TracingManager): (c: GravitoContext, next: () => Promise<void>) => Promise<Response | undefined>;
|
|
10
|
-
export { type Span, type SpanContext, type SpanEvent, TracingManager } from './TracingManager';
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/photon - High-performance web engine for the Gravito Galaxy Architecture.
|
|
3
|
-
*
|
|
4
|
-
* Photon serves as the foundational HTTP layer for Gravito, providing an ultra-fast,
|
|
5
|
-
* type-safe routing system based on Hono. It is designed to be the "light" that
|
|
6
|
-
* connects Satellites (domain plugins) and Orbits (infrastructure) within the ecosystem.
|
|
7
|
-
*
|
|
8
|
-
* Key features:
|
|
9
|
-
* - Zero-overhead routing and middleware.
|
|
10
|
-
* - Full TypeScript inference for request parameters and body.
|
|
11
|
-
* - Built-in support for HTMX and binary (CBOR) protocols.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import { Photon } from '@gravito/photon'
|
|
16
|
-
*
|
|
17
|
-
* const app = new Photon()
|
|
18
|
-
*
|
|
19
|
-
* app.get('/welcome', (c) => c.text('Welcome to the Galaxy!'))
|
|
20
|
-
*
|
|
21
|
-
* export default app
|
|
22
|
-
* ```
|
|
23
|
-
* @packageDocumentation
|
|
24
|
-
*/
|
|
25
|
-
export * from 'hono';
|
|
26
|
-
/**
|
|
27
|
-
* The primary application class for Photon.
|
|
28
|
-
*
|
|
29
|
-
* An alias for `Hono`, providing the core routing and middleware capabilities.
|
|
30
|
-
* Use this to define your API structure and mount domain-specific Satellites.
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Photon extends Hono's capabilities with Gravito-specific optimizations.
|
|
34
|
-
* It serves as the entry point for defining routes, applying middleware,
|
|
35
|
-
* and handling the request-response lifecycle.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const app = new Photon()
|
|
40
|
-
*
|
|
41
|
-
* // Basic routing
|
|
42
|
-
* app.get('/api/health', (c) => c.json({ status: 'ok' }))
|
|
43
|
-
*
|
|
44
|
-
* // Middleware integration
|
|
45
|
-
* app.use('/api/*', myMiddleware)
|
|
46
|
-
*
|
|
47
|
-
* // Mounting sub-routers
|
|
48
|
-
* app.route('/v1', v1Router)
|
|
49
|
-
* ```
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
export { Hono as Photon } from 'hono';
|
|
53
|
-
/**
|
|
54
|
-
* Binary-related middleware for Photon.
|
|
55
|
-
*
|
|
56
|
-
* Provides utilities for handling binary data formats like CBOR,
|
|
57
|
-
* optimizing payload size and serialization speed for high-performance APIs.
|
|
58
|
-
*
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
export * from './middleware/binary';
|
|
62
|
-
/**
|
|
63
|
-
* HTMX-related middleware for Photon.
|
|
64
|
-
*
|
|
65
|
-
* Enhances Photon with first-class support for HTMX, including
|
|
66
|
-
* automatic request detection and simplified header access for hypermedia-driven UIs.
|
|
67
|
-
*
|
|
68
|
-
* @public
|
|
69
|
-
*/
|
|
70
|
-
export * from './middleware/htmx';
|
|
71
|
-
/**
|
|
72
|
-
* Rate limiting middleware for Photon.
|
|
73
|
-
*
|
|
74
|
-
* Provides built-in rate limiting with token bucket and sliding window strategies.
|
|
75
|
-
* Supports both memory-based and custom storage backends.
|
|
76
|
-
*
|
|
77
|
-
* @public
|
|
78
|
-
*/
|
|
79
|
-
export * from './middleware/ratelimit';
|
|
80
|
-
/**
|
|
81
|
-
* Redis-based rate limiting storage.
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
export * from './middleware/ratelimit-redis';
|
|
85
|
-
/**
|
|
86
|
-
* OpenAPI utilities
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
export * from './openapi';
|