effect 4.0.0-beta.102 → 4.0.0-beta.103
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/dist/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +336 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +115 -80
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2841 -3247
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1322 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +228 -306
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +644 -642
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +491 -527
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +27 -50
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +366 -279
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2415 -2949
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1078 -1381
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +50 -18
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +94 -117
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +104 -64
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +141 -75
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +58 -50
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +694 -241
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +69 -76
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +57 -61
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +238 -42
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +128 -46
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +344 -136
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -2
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -5
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
- package/dist/unstable/eventlog/EventJournal.js +13 -13
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.js +4 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.js +5 -5
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +11 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.js +13 -13
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +17 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +24 -13
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +12 -11
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.js +2 -2
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +9 -4
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.js +15 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +891 -816
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +615 -332
- package/src/ConfigProvider.ts +214 -120
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2893 -3279
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +620 -786
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +716 -745
- package/src/SchemaAST.ts +466 -358
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +180 -93
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2602 -3123
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +93 -48
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +72 -30
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +95 -118
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +107 -67
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +60 -50
- package/src/unstable/ai/McpServer.ts +930 -304
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +69 -76
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +705 -107
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +292 -78
- package/src/unstable/cli/Primitive.ts +370 -149
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +4 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +7 -8
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +11 -15
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +15 -15
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +2 -2
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +2 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +4 -4
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +6 -6
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +14 -14
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +13 -13
- package/src/unstable/observability/OtlpExporter.ts +31 -19
- package/src/unstable/observability/OtlpMetrics.ts +4 -1
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +26 -15
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +16 -15
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +5 -5
- package/src/unstable/socket/Socket.ts +17 -4
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +24 -23
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/internal/version.ts +0 -2
package/dist/Metric.d.ts
CHANGED
|
@@ -38,12 +38,8 @@ import type { Contravariant, Covariant } from "./Types.ts";
|
|
|
38
38
|
*
|
|
39
39
|
* **Example** (Using multiple metric types)
|
|
40
40
|
*
|
|
41
|
-
* ```ts
|
|
42
|
-
* import {
|
|
43
|
-
*
|
|
44
|
-
* class MetricExample extends Data.TaggedError("MetricExample")<{
|
|
45
|
-
* readonly operation: string
|
|
46
|
-
* }> {}
|
|
41
|
+
* ```ts import.meta.vitest
|
|
42
|
+
* import { Effect, Metric } from "effect"
|
|
47
43
|
*
|
|
48
44
|
* const program = Effect.gen(function*() {
|
|
49
45
|
* // Create different types of metrics
|
|
@@ -89,6 +85,13 @@ import type { Contravariant, Covariant } from "./Types.ts";
|
|
|
89
85
|
* }
|
|
90
86
|
* }
|
|
91
87
|
* })
|
|
88
|
+
*
|
|
89
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
90
|
+
* const values = [
|
|
91
|
+
* result.counter.state.count,
|
|
92
|
+
* result.gauge.state.value,
|
|
93
|
+
* result.frequency.state.occurrences.get("200")
|
|
94
|
+
* ] // => [1, 128, 1]
|
|
92
95
|
* ```
|
|
93
96
|
*
|
|
94
97
|
* @category models
|
|
@@ -116,12 +119,8 @@ export interface Metric<in Input, out State> extends Pipeable {
|
|
|
116
119
|
*
|
|
117
120
|
* **Example** (Using counter metrics)
|
|
118
121
|
*
|
|
119
|
-
* ```ts
|
|
120
|
-
* import {
|
|
121
|
-
*
|
|
122
|
-
* class CounterInterfaceError extends Data.TaggedError("CounterInterfaceError")<{
|
|
123
|
-
* readonly operation: string
|
|
124
|
-
* }> {}
|
|
122
|
+
* ```ts import.meta.vitest
|
|
123
|
+
* import { Effect, Metric } from "effect"
|
|
125
124
|
*
|
|
126
125
|
* const program = Effect.gen(function*() {
|
|
127
126
|
* // Create different types of counters
|
|
@@ -167,9 +166,12 @@ export interface Metric<in Input, out State> extends Pipeable {
|
|
|
167
166
|
* bytes: { count: bytesState.count, incremental: bytesState.incremental }
|
|
168
167
|
* }
|
|
169
168
|
* })
|
|
169
|
+
*
|
|
170
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
171
|
+
* const counts = [result.requests.count, result.bytes.count] // => [6, 1024n]
|
|
170
172
|
* ```
|
|
171
173
|
*
|
|
172
|
-
* @category
|
|
174
|
+
* @category models
|
|
173
175
|
* @since 2.0.0
|
|
174
176
|
*/
|
|
175
177
|
export interface Counter<in Input extends number | bigint> extends Metric<Input, CounterState<Input>> {
|
|
@@ -179,12 +181,8 @@ export interface Counter<in Input extends number | bigint> extends Metric<Input,
|
|
|
179
181
|
*
|
|
180
182
|
* **Example** (Reading counter state)
|
|
181
183
|
*
|
|
182
|
-
* ```ts
|
|
183
|
-
* import {
|
|
184
|
-
*
|
|
185
|
-
* class CounterStateError extends Data.TaggedError("CounterStateError")<{
|
|
186
|
-
* readonly operation: string
|
|
187
|
-
* }> {}
|
|
184
|
+
* ```ts import.meta.vitest
|
|
185
|
+
* import { Effect, Metric } from "effect"
|
|
188
186
|
*
|
|
189
187
|
* const program = Effect.gen(function*() {
|
|
190
188
|
* // Create different types of counters
|
|
@@ -209,7 +207,6 @@ export interface Counter<in Input extends number | bigint> extends Metric<Input,
|
|
|
209
207
|
* const byteState: Metric.CounterState<bigint> = yield* Metric.value(
|
|
210
208
|
* byteCounter
|
|
211
209
|
* )
|
|
212
|
-
*
|
|
213
210
|
* // CounterState contains:
|
|
214
211
|
* // - count: current count value (number or bigint based on counter type)
|
|
215
212
|
* // - incremental: whether counter only allows increases
|
|
@@ -229,9 +226,12 @@ export interface Counter<in Input extends number | bigint> extends Metric<Input,
|
|
|
229
226
|
* }
|
|
230
227
|
* }
|
|
231
228
|
* })
|
|
229
|
+
*
|
|
230
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
231
|
+
* const counts = [result.requests.total, result.errors.total, result.bytes.total] // => [3, 3, 1024000n]
|
|
232
232
|
* ```
|
|
233
233
|
*
|
|
234
|
-
* @category
|
|
234
|
+
* @category models
|
|
235
235
|
* @since 4.0.0
|
|
236
236
|
*/
|
|
237
237
|
export interface CounterState<in Input extends number | bigint> {
|
|
@@ -249,32 +249,16 @@ export interface CounterState<in Input extends number | bigint> {
|
|
|
249
249
|
*
|
|
250
250
|
* **Example** (Using frequency metrics)
|
|
251
251
|
*
|
|
252
|
-
* ```ts
|
|
253
|
-
* import {
|
|
254
|
-
*
|
|
255
|
-
* class FrequencyInterfaceError
|
|
256
|
-
* extends Data.TaggedError("FrequencyInterfaceError")<{
|
|
257
|
-
* readonly operation: string
|
|
258
|
-
* }>
|
|
259
|
-
* {}
|
|
252
|
+
* ```ts import.meta.vitest
|
|
253
|
+
* import { Effect, Metric } from "effect"
|
|
260
254
|
*
|
|
261
255
|
* // Function that accepts any Frequency metric
|
|
262
|
-
* const
|
|
256
|
+
* const analyzeFrequencyMetric = (freq: Metric.Frequency) =>
|
|
263
257
|
* Effect.gen(function*() {
|
|
264
258
|
* const state = yield* Metric.value(freq)
|
|
265
259
|
*
|
|
266
|
-
* yield* Effect.log(`Frequency Metric: ${freq.id}`)
|
|
267
|
-
* yield* Effect.log(`Description: ${freq.description ?? "No description"}`)
|
|
268
|
-
* yield* Effect.log(`Type: ${freq.type}`) // "Frequency"
|
|
269
|
-
*
|
|
270
260
|
* // Access the frequency state
|
|
271
261
|
* const occurrences: ReadonlyMap<string, number> = state.occurrences
|
|
272
|
-
* yield* Effect.log(`Total unique values: ${occurrences.size}`)
|
|
273
|
-
*
|
|
274
|
-
* // Iterate through all occurrences
|
|
275
|
-
* for (const [value, count] of occurrences) {
|
|
276
|
-
* yield* Effect.log(` "${value}": ${count} occurrences`)
|
|
277
|
-
* }
|
|
278
262
|
*
|
|
279
263
|
* // Find most frequent value
|
|
280
264
|
* let maxCount = 0
|
|
@@ -311,14 +295,16 @@ export interface CounterState<in Input extends number | bigint> {
|
|
|
311
295
|
* yield* Metric.update(userActions, "login")
|
|
312
296
|
*
|
|
313
297
|
* // Use the function with different frequency metrics
|
|
314
|
-
* const statusAnalysis = yield*
|
|
315
|
-
* const actionAnalysis = yield*
|
|
316
|
-
*
|
|
298
|
+
* const statusAnalysis = yield* analyzeFrequencyMetric(statusCodes)
|
|
299
|
+
* const actionAnalysis = yield* analyzeFrequencyMetric(userActions)
|
|
317
300
|
* return { statusAnalysis, actionAnalysis }
|
|
318
301
|
* })
|
|
302
|
+
*
|
|
303
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
304
|
+
* const values = [result.statusAnalysis.mostFrequent, result.actionAnalysis.mostFrequent] // => ["200", "login"]
|
|
319
305
|
* ```
|
|
320
306
|
*
|
|
321
|
-
* @category
|
|
307
|
+
* @category models
|
|
322
308
|
* @since 2.0.0
|
|
323
309
|
*/
|
|
324
310
|
export interface Frequency extends Metric<string, FrequencyState> {
|
|
@@ -328,12 +314,8 @@ export interface Frequency extends Metric<string, FrequencyState> {
|
|
|
328
314
|
*
|
|
329
315
|
* **Example** (Reading frequency state)
|
|
330
316
|
*
|
|
331
|
-
* ```ts
|
|
332
|
-
* import {
|
|
333
|
-
*
|
|
334
|
-
* class FrequencyStateError extends Data.TaggedError("FrequencyStateError")<{
|
|
335
|
-
* readonly operation: string
|
|
336
|
-
* }> {}
|
|
317
|
+
* ```ts import.meta.vitest
|
|
318
|
+
* import { Effect, Metric } from "effect"
|
|
337
319
|
*
|
|
338
320
|
* const program = Effect.gen(function*() {
|
|
339
321
|
* // Create frequency metrics for different categories
|
|
@@ -381,7 +363,6 @@ export interface Frequency extends Metric<string, FrequencyState> {
|
|
|
381
363
|
*
|
|
382
364
|
* const topStatus = getMostFrequent(statusState.occurrences)
|
|
383
365
|
* const topAction = getMostFrequent(actionState.occurrences)
|
|
384
|
-
*
|
|
385
366
|
* return {
|
|
386
367
|
* statusCodes: {
|
|
387
368
|
* totalResponses: Array.from(statusState.occurrences.values()).reduce(
|
|
@@ -401,9 +382,13 @@ export interface Frequency extends Metric<string, FrequencyState> {
|
|
|
401
382
|
* }
|
|
402
383
|
* }
|
|
403
384
|
* })
|
|
385
|
+
*
|
|
386
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
387
|
+
* const mostCommon = [result.statusCodes.mostCommon, result.userActions.mostCommon]
|
|
388
|
+
* mostCommon.map(({ key, count }) => [key, count]) // => [["200", 3], ["click", 3]]
|
|
404
389
|
* ```
|
|
405
390
|
*
|
|
406
|
-
* @category
|
|
391
|
+
* @category models
|
|
407
392
|
* @since 4.0.0
|
|
408
393
|
*/
|
|
409
394
|
export interface FrequencyState {
|
|
@@ -419,12 +404,8 @@ export interface FrequencyState {
|
|
|
419
404
|
*
|
|
420
405
|
* **Example** (Using gauge metrics)
|
|
421
406
|
*
|
|
422
|
-
* ```ts
|
|
423
|
-
* import {
|
|
424
|
-
*
|
|
425
|
-
* class GaugeInterfaceError extends Data.TaggedError("GaugeInterfaceError")<{
|
|
426
|
-
* readonly operation: string
|
|
427
|
-
* }> {}
|
|
407
|
+
* ```ts import.meta.vitest
|
|
408
|
+
* import { Effect, Metric } from "effect"
|
|
428
409
|
*
|
|
429
410
|
* const program = Effect.gen(function*() {
|
|
430
411
|
* // Create different types of gauges
|
|
@@ -454,7 +435,6 @@ export interface FrequencyState {
|
|
|
454
435
|
* const diskState: Metric.GaugeState<bigint> = yield* Metric.value(
|
|
455
436
|
* diskSpaceGauge
|
|
456
437
|
* )
|
|
457
|
-
*
|
|
458
438
|
* // Gauge state contains:
|
|
459
439
|
* // - value: current instantaneous value
|
|
460
440
|
*
|
|
@@ -463,9 +443,12 @@ export interface FrequencyState {
|
|
|
463
443
|
* disk: { currentValue: diskState.value } // 5000000000n
|
|
464
444
|
* }
|
|
465
445
|
* })
|
|
446
|
+
*
|
|
447
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
448
|
+
* const values = [result.memory.currentValue, result.disk.currentValue] // => [704, 5000000000n]
|
|
466
449
|
* ```
|
|
467
450
|
*
|
|
468
|
-
* @category
|
|
451
|
+
* @category models
|
|
469
452
|
* @since 2.0.0
|
|
470
453
|
*/
|
|
471
454
|
export interface Gauge<in Input extends number | bigint> extends Metric<Input, GaugeState<Input>> {
|
|
@@ -475,12 +458,8 @@ export interface Gauge<in Input extends number | bigint> extends Metric<Input, G
|
|
|
475
458
|
*
|
|
476
459
|
* **Example** (Reading gauge state)
|
|
477
460
|
*
|
|
478
|
-
* ```ts
|
|
479
|
-
* import {
|
|
480
|
-
*
|
|
481
|
-
* class GaugeStateError extends Data.TaggedError("GaugeStateError")<{
|
|
482
|
-
* readonly operation: string
|
|
483
|
-
* }> {}
|
|
461
|
+
* ```ts import.meta.vitest
|
|
462
|
+
* import { Effect, Metric } from "effect"
|
|
484
463
|
*
|
|
485
464
|
* const program = Effect.gen(function*() {
|
|
486
465
|
* // Create different types of gauges
|
|
@@ -516,7 +495,6 @@ export interface Gauge<in Input extends number | bigint> extends Metric<Input, G
|
|
|
516
495
|
* const queueState: Metric.GaugeState<number> = yield* Metric.value(
|
|
517
496
|
* queueSizeGauge
|
|
518
497
|
* )
|
|
519
|
-
*
|
|
520
498
|
* // GaugeState contains:
|
|
521
499
|
* // - value: current instantaneous value (number or bigint based on gauge type)
|
|
522
500
|
*
|
|
@@ -532,9 +510,13 @@ export interface Gauge<in Input extends number | bigint> extends Metric<Input, G
|
|
|
532
510
|
* }
|
|
533
511
|
* }
|
|
534
512
|
* })
|
|
513
|
+
*
|
|
514
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
515
|
+
* const values = [result.environment.temperature, result.system.diskUsage, result.system.queueSize]
|
|
516
|
+
* values // => [23.1, 5000000000n, 15]
|
|
535
517
|
* ```
|
|
536
518
|
*
|
|
537
|
-
* @category
|
|
519
|
+
* @category models
|
|
538
520
|
* @since 4.0.0
|
|
539
521
|
*/
|
|
540
522
|
export interface GaugeState<in Input extends number | bigint> {
|
|
@@ -550,14 +532,8 @@ export interface GaugeState<in Input extends number | bigint> {
|
|
|
550
532
|
*
|
|
551
533
|
* **Example** (Using histogram metrics)
|
|
552
534
|
*
|
|
553
|
-
* ```ts
|
|
554
|
-
* import {
|
|
555
|
-
*
|
|
556
|
-
* class HistogramInterfaceError
|
|
557
|
-
* extends Data.TaggedError("HistogramInterfaceError")<{
|
|
558
|
-
* readonly operation: string
|
|
559
|
-
* }>
|
|
560
|
-
* {}
|
|
535
|
+
* ```ts import.meta.vitest
|
|
536
|
+
* import { Effect, Metric } from "effect"
|
|
561
537
|
*
|
|
562
538
|
* const program = Effect.gen(function*() {
|
|
563
539
|
* // Create histograms with different boundary strategies
|
|
@@ -565,7 +541,7 @@ export interface GaugeState<in Input extends number | bigint> {
|
|
|
565
541
|
* "http_response_time_ms",
|
|
566
542
|
* {
|
|
567
543
|
* description: "HTTP response time distribution in milliseconds",
|
|
568
|
-
* boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 20 }) //
|
|
544
|
+
* boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 20 }) // 50, 100, ..., 900, Infinity
|
|
569
545
|
* }
|
|
570
546
|
* )
|
|
571
547
|
*
|
|
@@ -598,7 +574,6 @@ export interface GaugeState<in Input extends number | bigint> {
|
|
|
598
574
|
* const fileSizeState: Metric.HistogramState = yield* Metric.value(
|
|
599
575
|
* fileSizeHistogram
|
|
600
576
|
* )
|
|
601
|
-
*
|
|
602
577
|
* // Histogram state contains:
|
|
603
578
|
* // - buckets: Array of [boundary, cumulativeCount] pairs
|
|
604
579
|
* // - count: total number of observations
|
|
@@ -622,9 +597,13 @@ export interface GaugeState<in Input extends number | bigint> {
|
|
|
622
597
|
* }
|
|
623
598
|
* }
|
|
624
599
|
* })
|
|
600
|
+
*
|
|
601
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
602
|
+
* const values = [result.responseTime.totalRequests, result.responseTime.totalTime, result.fileSize.totalBytes]
|
|
603
|
+
* values // => [4, 445, 118]
|
|
625
604
|
* ```
|
|
626
605
|
*
|
|
627
|
-
* @category
|
|
606
|
+
* @category models
|
|
628
607
|
* @since 2.0.0
|
|
629
608
|
*/
|
|
630
609
|
export interface Histogram<Input> extends Metric<Input, HistogramState> {
|
|
@@ -634,18 +613,14 @@ export interface Histogram<Input> extends Metric<Input, HistogramState> {
|
|
|
634
613
|
*
|
|
635
614
|
* **Example** (Reading histogram state)
|
|
636
615
|
*
|
|
637
|
-
* ```ts
|
|
638
|
-
* import {
|
|
639
|
-
*
|
|
640
|
-
* class HistogramStateError extends Data.TaggedError("HistogramStateError")<{
|
|
641
|
-
* readonly operation: string
|
|
642
|
-
* }> {}
|
|
616
|
+
* ```ts import.meta.vitest
|
|
617
|
+
* import { Effect, Metric } from "effect"
|
|
643
618
|
*
|
|
644
619
|
* const program = Effect.gen(function*() {
|
|
645
620
|
* // Create histogram with linear boundaries
|
|
646
621
|
* const responseTimeHistogram = Metric.histogram("api_response_time_ms", {
|
|
647
622
|
* description: "API response time distribution",
|
|
648
|
-
* boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 }) //
|
|
623
|
+
* boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 }) // 100, 200, ..., 800, Infinity
|
|
649
624
|
* })
|
|
650
625
|
*
|
|
651
626
|
* // Record observations
|
|
@@ -692,7 +667,6 @@ export interface Histogram<Input> extends Metric<Input, HistogramState> {
|
|
|
692
667
|
* }
|
|
693
668
|
*
|
|
694
669
|
* const bucketAnalysis = analyzeBuckets(state.buckets)
|
|
695
|
-
*
|
|
696
670
|
* return {
|
|
697
671
|
* responseTime: {
|
|
698
672
|
* totalRequests: state.count, // 5
|
|
@@ -709,9 +683,14 @@ export interface Histogram<Input> extends Metric<Input, HistogramState> {
|
|
|
709
683
|
* }
|
|
710
684
|
* }
|
|
711
685
|
* })
|
|
686
|
+
*
|
|
687
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
688
|
+
* const stats = result.responseTime
|
|
689
|
+
* const values = [stats.totalRequests, stats.fastestResponse, stats.slowestResponse, stats.totalTime]
|
|
690
|
+
* values // => [5, 50, 750, 1295]
|
|
712
691
|
* ```
|
|
713
692
|
*
|
|
714
|
-
* @category
|
|
693
|
+
* @category models
|
|
715
694
|
* @since 4.0.0
|
|
716
695
|
*/
|
|
717
696
|
export interface HistogramState {
|
|
@@ -732,12 +711,8 @@ export interface HistogramState {
|
|
|
732
711
|
*
|
|
733
712
|
* **Example** (Using summary metrics)
|
|
734
713
|
*
|
|
735
|
-
* ```ts
|
|
736
|
-
* import {
|
|
737
|
-
*
|
|
738
|
-
* class SummaryInterfaceError extends Data.TaggedError("SummaryInterfaceError")<{
|
|
739
|
-
* readonly operation: string
|
|
740
|
-
* }> {}
|
|
714
|
+
* ```ts import.meta.vitest
|
|
715
|
+
* import { Effect, Metric } from "effect"
|
|
741
716
|
*
|
|
742
717
|
* const program = Effect.gen(function*() {
|
|
743
718
|
* // Create summaries with different quantile configurations
|
|
@@ -796,7 +771,6 @@ export interface HistogramState {
|
|
|
796
771
|
* const median = getQuantileValue(responseTimeState.quantiles, 0.5)
|
|
797
772
|
* const p95 = getQuantileValue(responseTimeState.quantiles, 0.95)
|
|
798
773
|
* const p99 = getQuantileValue(responseTimeState.quantiles, 0.99)
|
|
799
|
-
*
|
|
800
774
|
* return {
|
|
801
775
|
* responseTime: {
|
|
802
776
|
* totalRequests: responseTimeState.count, // 5
|
|
@@ -814,9 +788,13 @@ export interface HistogramState {
|
|
|
814
788
|
* }
|
|
815
789
|
* }
|
|
816
790
|
* })
|
|
791
|
+
*
|
|
792
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
793
|
+
* const counts = [result.responseTime.totalRequests, result.responseTime.totalTime, result.requestSize.totalRequests]
|
|
794
|
+
* counts // => [5, 1461, 3]
|
|
817
795
|
* ```
|
|
818
796
|
*
|
|
819
|
-
* @category
|
|
797
|
+
* @category models
|
|
820
798
|
* @since 2.0.0
|
|
821
799
|
*/
|
|
822
800
|
export interface Summary<Input> extends Metric<Input, SummaryState> {
|
|
@@ -826,12 +804,8 @@ export interface Summary<Input> extends Metric<Input, SummaryState> {
|
|
|
826
804
|
*
|
|
827
805
|
* **Example** (Reading summary state)
|
|
828
806
|
*
|
|
829
|
-
* ```ts
|
|
830
|
-
* import {
|
|
831
|
-
*
|
|
832
|
-
* class SummaryStateError extends Data.TaggedError("SummaryStateError")<{
|
|
833
|
-
* readonly operation: string
|
|
834
|
-
* }> {}
|
|
807
|
+
* ```ts import.meta.vitest
|
|
808
|
+
* import { Effect, Metric } from "effect"
|
|
835
809
|
*
|
|
836
810
|
* const program = Effect.gen(function*() {
|
|
837
811
|
* // Create summary with specific quantiles
|
|
@@ -874,7 +848,6 @@ export interface Summary<Input> extends Metric<Input, SummaryState> {
|
|
|
874
848
|
* }
|
|
875
849
|
*
|
|
876
850
|
* const quantileValues = extractQuantiles(state.quantiles)
|
|
877
|
-
*
|
|
878
851
|
* return {
|
|
879
852
|
* latencyAnalysis: {
|
|
880
853
|
* totalRequests: state.count, // 7
|
|
@@ -896,9 +869,14 @@ export interface Summary<Input> extends Metric<Input, SummaryState> {
|
|
|
896
869
|
* }
|
|
897
870
|
* }
|
|
898
871
|
* })
|
|
872
|
+
*
|
|
873
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
874
|
+
* const analysis = result.latencyAnalysis
|
|
875
|
+
* const values = [analysis.totalRequests, analysis.fastestResponse, analysis.slowestResponse, analysis.totalLatency]
|
|
876
|
+
* values // => [7, 45, 890, 1879]
|
|
899
877
|
* ```
|
|
900
878
|
*
|
|
901
|
-
* @category
|
|
879
|
+
* @category models
|
|
902
880
|
* @since 4.0.0
|
|
903
881
|
*/
|
|
904
882
|
export interface SummaryState {
|
|
@@ -914,12 +892,8 @@ export interface SummaryState {
|
|
|
914
892
|
*
|
|
915
893
|
* **Example** (Collecting application metrics)
|
|
916
894
|
*
|
|
917
|
-
* ```ts
|
|
918
|
-
* import {
|
|
919
|
-
*
|
|
920
|
-
* class MetricsError extends Data.TaggedError("MetricsError")<{
|
|
921
|
-
* readonly operation: string
|
|
922
|
-
* }> {}
|
|
895
|
+
* ```ts import.meta.vitest
|
|
896
|
+
* import { Effect, Metric } from "effect"
|
|
923
897
|
*
|
|
924
898
|
* const program = Effect.gen(function*() {
|
|
925
899
|
* // Create different types of metrics
|
|
@@ -949,6 +923,9 @@ export interface SummaryState {
|
|
|
949
923
|
* frequency: frequencyValue
|
|
950
924
|
* }
|
|
951
925
|
* })
|
|
926
|
+
*
|
|
927
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
928
|
+
* const values = [result.counter.count, result.gauge.value] // => [1, 12]
|
|
952
929
|
* ```
|
|
953
930
|
*
|
|
954
931
|
* @since 2.0.0
|
|
@@ -959,78 +936,28 @@ export declare namespace Metric {
|
|
|
959
936
|
*
|
|
960
937
|
* **Example** (Inspecting metric types)
|
|
961
938
|
*
|
|
962
|
-
* ```ts
|
|
963
|
-
* import {
|
|
964
|
-
*
|
|
965
|
-
* class MetricTypeError extends Data.TaggedError("MetricTypeError")<{
|
|
966
|
-
* readonly operation: string
|
|
967
|
-
* }> {}
|
|
939
|
+
* ```ts import.meta.vitest
|
|
940
|
+
* import { Metric } from "effect"
|
|
968
941
|
*
|
|
969
|
-
* const
|
|
970
|
-
*
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
* const histogram = Metric.histogram("response_time", {
|
|
942
|
+
* const metrics: ReadonlyArray<Metric.Metric<any, any>> = [
|
|
943
|
+
* Metric.counter("requests_total"),
|
|
944
|
+
* Metric.gauge("cpu_usage"),
|
|
945
|
+
* Metric.frequency("status_codes"),
|
|
946
|
+
* Metric.histogram("response_time", {
|
|
975
947
|
* boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 10 })
|
|
976
|
-
* })
|
|
977
|
-
*
|
|
948
|
+
* }),
|
|
949
|
+
* Metric.summary("latency", {
|
|
978
950
|
* maxAge: "5 minutes",
|
|
979
951
|
* maxSize: 1000,
|
|
980
952
|
* quantiles: [0.5, 0.95, 0.99]
|
|
981
953
|
* })
|
|
954
|
+
* ]
|
|
982
955
|
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
* name: metric.id,
|
|
986
|
-
* type: metric.type
|
|
987
|
-
* })
|
|
988
|
-
*
|
|
989
|
-
* // Get type information for each metric
|
|
990
|
-
* const counterInfo = getMetricInfo(counter) // { name: "requests_total", type: "Counter" }
|
|
991
|
-
* const gaugeInfo = getMetricInfo(gauge) // { name: "cpu_usage", type: "Gauge" }
|
|
992
|
-
* const frequencyInfo = getMetricInfo(frequency) // { name: "status_codes", type: "Frequency" }
|
|
993
|
-
* const histogramInfo = getMetricInfo(histogram) // { name: "response_time", type: "Histogram" }
|
|
994
|
-
* const summaryInfo = getMetricInfo(summary) // { name: "latency", type: "Summary" }
|
|
995
|
-
*
|
|
996
|
-
* // Pattern match on metric type
|
|
997
|
-
* const describeMetric = (type: string): string => {
|
|
998
|
-
* switch (type) {
|
|
999
|
-
* case "Counter":
|
|
1000
|
-
* return "Cumulative values that increase over time"
|
|
1001
|
-
* case "Gauge":
|
|
1002
|
-
* return "Instantaneous values that can go up or down"
|
|
1003
|
-
* case "Frequency":
|
|
1004
|
-
* return "Counts of discrete string occurrences"
|
|
1005
|
-
* case "Histogram":
|
|
1006
|
-
* return "Distribution of values across buckets"
|
|
1007
|
-
* case "Summary":
|
|
1008
|
-
* return "Quantile calculations over time windows"
|
|
1009
|
-
* default:
|
|
1010
|
-
* return "Unknown metric type"
|
|
1011
|
-
* }
|
|
1012
|
-
* }
|
|
1013
|
-
*
|
|
1014
|
-
* return {
|
|
1015
|
-
* metrics: [
|
|
1016
|
-
* counterInfo,
|
|
1017
|
-
* gaugeInfo,
|
|
1018
|
-
* frequencyInfo,
|
|
1019
|
-
* histogramInfo,
|
|
1020
|
-
* summaryInfo
|
|
1021
|
-
* ],
|
|
1022
|
-
* descriptions: {
|
|
1023
|
-
* Counter: describeMetric("Counter"),
|
|
1024
|
-
* Gauge: describeMetric("Gauge"),
|
|
1025
|
-
* Frequency: describeMetric("Frequency"),
|
|
1026
|
-
* Histogram: describeMetric("Histogram"),
|
|
1027
|
-
* Summary: describeMetric("Summary")
|
|
1028
|
-
* }
|
|
1029
|
-
* }
|
|
1030
|
-
* })
|
|
956
|
+
* const types: ReadonlyArray<Metric.Metric.Type> = metrics.map((metric) => metric.type)
|
|
957
|
+
* const actual = types // => ["Counter", "Gauge", "Frequency", "Histogram", "Summary"]
|
|
1031
958
|
* ```
|
|
1032
959
|
*
|
|
1033
|
-
* @category
|
|
960
|
+
* @category models
|
|
1034
961
|
* @since 4.0.0
|
|
1035
962
|
*/
|
|
1036
963
|
type Type = "Counter" | "Frequency" | "Gauge" | "Histogram" | "Summary";
|
|
@@ -1039,12 +966,8 @@ export declare namespace Metric {
|
|
|
1039
966
|
*
|
|
1040
967
|
* **Example** (Providing attributes in different formats)
|
|
1041
968
|
*
|
|
1042
|
-
* ```ts
|
|
1043
|
-
* import {
|
|
1044
|
-
*
|
|
1045
|
-
* class AttributesError extends Data.TaggedError("AttributesError")<{
|
|
1046
|
-
* readonly operation: string
|
|
1047
|
-
* }> {}
|
|
969
|
+
* ```ts import.meta.vitest
|
|
970
|
+
* import { Effect, Metric } from "effect"
|
|
1048
971
|
*
|
|
1049
972
|
* const program = Effect.gen(function*() {
|
|
1050
973
|
* // Different ways to specify attributes
|
|
@@ -1093,19 +1016,22 @@ export declare namespace Metric {
|
|
|
1093
1016
|
* // Both formats result in the same internal representation
|
|
1094
1017
|
* const normalizedObject = normalizeAttributes(attributesAsObject)
|
|
1095
1018
|
* const normalizedArray = normalizeAttributes(attributesAsArray)
|
|
1096
|
-
*
|
|
1097
1019
|
* return {
|
|
1098
1020
|
* attributeFormats: {
|
|
1099
1021
|
* object: normalizedObject, // { service: "api", environment: "production", version: "1.2.3" }
|
|
1100
|
-
* array: normalizedArray
|
|
1101
|
-
* areEqual:
|
|
1102
|
-
* JSON.stringify(normalizedObject) === JSON.stringify(normalizedArray) // true
|
|
1022
|
+
* array: normalizedArray // { service: "api", environment: "production", version: "1.2.3" }
|
|
1103
1023
|
* }
|
|
1104
1024
|
* }
|
|
1105
1025
|
* })
|
|
1026
|
+
*
|
|
1027
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1028
|
+
* const objectAttributes = result.attributeFormats.object
|
|
1029
|
+
* const arrayAttributes = result.attributeFormats.array
|
|
1030
|
+
* const sameAttributes = [objectAttributes, arrayAttributes]
|
|
1031
|
+
* sameAttributes // => [{ service: "api", environment: "production", version: "1.2.3" }, { service: "api", environment: "production", version: "1.2.3" }]
|
|
1106
1032
|
* ```
|
|
1107
1033
|
*
|
|
1108
|
-
* @category
|
|
1034
|
+
* @category models
|
|
1109
1035
|
* @since 4.0.0
|
|
1110
1036
|
*/
|
|
1111
1037
|
type Attributes = AttributeSet | ReadonlyArray<[string, string]>;
|
|
@@ -1114,12 +1040,8 @@ export declare namespace Metric {
|
|
|
1114
1040
|
*
|
|
1115
1041
|
* **Example** (Combining metric attribute sets)
|
|
1116
1042
|
*
|
|
1117
|
-
* ```ts
|
|
1118
|
-
* import {
|
|
1119
|
-
*
|
|
1120
|
-
* class AttributeSetError extends Data.TaggedError("AttributeSetError")<{
|
|
1121
|
-
* readonly operation: string
|
|
1122
|
-
* }> {}
|
|
1043
|
+
* ```ts import.meta.vitest
|
|
1044
|
+
* import { Effect, Metric } from "effect"
|
|
1123
1045
|
*
|
|
1124
1046
|
* const program = Effect.gen(function*() {
|
|
1125
1047
|
* // Define attribute sets for different contexts
|
|
@@ -1180,9 +1102,12 @@ export declare namespace Metric {
|
|
|
1180
1102
|
* }
|
|
1181
1103
|
* }
|
|
1182
1104
|
* })
|
|
1105
|
+
*
|
|
1106
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1107
|
+
* const validation = [result.attributes.isValid, result.attributes.totalKeys] // => [true, 9]
|
|
1183
1108
|
* ```
|
|
1184
1109
|
*
|
|
1185
|
-
* @category
|
|
1110
|
+
* @category models
|
|
1186
1111
|
* @since 4.0.0
|
|
1187
1112
|
*/
|
|
1188
1113
|
type AttributeSet = Readonly<Record<string, string>>;
|
|
@@ -1191,7 +1116,7 @@ export declare namespace Metric {
|
|
|
1191
1116
|
*
|
|
1192
1117
|
* **Example** (Extracting metric input types)
|
|
1193
1118
|
*
|
|
1194
|
-
* ```ts
|
|
1119
|
+
* ```ts import.meta.vitest
|
|
1195
1120
|
* import { Metric } from "effect"
|
|
1196
1121
|
*
|
|
1197
1122
|
* // Create various metric types
|
|
@@ -1229,9 +1154,11 @@ export declare namespace Metric {
|
|
|
1229
1154
|
* // Metric.update(numberCounter, "abc") // ✗ Type error
|
|
1230
1155
|
* // Metric.update(stringFrequency, "ok") // ✓ Valid (string)
|
|
1231
1156
|
* // Metric.update(stringFrequency, 404) // ✗ Type error
|
|
1157
|
+
* const metricIds = metrics.map(({ id, type }) => `${id}:${type}`)
|
|
1158
|
+
* metricIds // => ["requests:Counter", "bytes:Counter", "status_codes:Frequency", "cpu_usage:Gauge", "response_time:Histogram"]
|
|
1232
1159
|
* ```
|
|
1233
1160
|
*
|
|
1234
|
-
* @category types
|
|
1161
|
+
* @category utility types
|
|
1235
1162
|
* @since 4.0.0
|
|
1236
1163
|
*/
|
|
1237
1164
|
type Input<A> = A extends Metric<infer _Input, infer _State> ? _Input : never;
|
|
@@ -1240,7 +1167,7 @@ export declare namespace Metric {
|
|
|
1240
1167
|
*
|
|
1241
1168
|
* **Example** (Extracting metric state types)
|
|
1242
1169
|
*
|
|
1243
|
-
* ```ts
|
|
1170
|
+
* ```ts import.meta.vitest
|
|
1244
1171
|
* import { Effect, Metric } from "effect"
|
|
1245
1172
|
*
|
|
1246
1173
|
* // Create various metric types
|
|
@@ -1278,7 +1205,6 @@ export declare namespace Metric {
|
|
|
1278
1205
|
* const frequencyState = yield* Metric.value(statusFrequency)
|
|
1279
1206
|
* const histogramState = yield* Metric.value(responseHistogram)
|
|
1280
1207
|
* const summaryState = yield* Metric.value(latencySummary)
|
|
1281
|
-
*
|
|
1282
1208
|
* return {
|
|
1283
1209
|
* counter: { count: counterState.count }, // { count: 10 }
|
|
1284
1210
|
* gauge: { value: gaugeState.value }, // { value: 85.5 }
|
|
@@ -1287,9 +1213,13 @@ export declare namespace Metric {
|
|
|
1287
1213
|
* summary: { observations: summaryState.count } // { observations: 1 }
|
|
1288
1214
|
* }
|
|
1289
1215
|
* })
|
|
1216
|
+
*
|
|
1217
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1218
|
+
* const values = [result.counter.count, result.gauge.value, result.frequency.uniqueValues]
|
|
1219
|
+
* values // => [10, 85.5, 1]
|
|
1290
1220
|
* ```
|
|
1291
1221
|
*
|
|
1292
|
-
* @category types
|
|
1222
|
+
* @category utility types
|
|
1293
1223
|
* @since 4.0.0
|
|
1294
1224
|
*/
|
|
1295
1225
|
type State<A> = A extends Metric<infer _Input, infer _State> ? _State : never;
|
|
@@ -1298,12 +1228,8 @@ export declare namespace Metric {
|
|
|
1298
1228
|
*
|
|
1299
1229
|
* **Example** (Using metric hooks)
|
|
1300
1230
|
*
|
|
1301
|
-
* ```ts
|
|
1302
|
-
* import {
|
|
1303
|
-
*
|
|
1304
|
-
* class HooksError extends Data.TaggedError("HooksError")<{
|
|
1305
|
-
* readonly operation: string
|
|
1306
|
-
* }> {}
|
|
1231
|
+
* ```ts import.meta.vitest
|
|
1232
|
+
* import { Effect, Metric } from "effect"
|
|
1307
1233
|
*
|
|
1308
1234
|
* const program = Effect.gen(function*() {
|
|
1309
1235
|
* // Create a counter metric
|
|
@@ -1331,9 +1257,12 @@ export declare namespace Metric {
|
|
|
1331
1257
|
* isIncremental: state.incremental // false
|
|
1332
1258
|
* }
|
|
1333
1259
|
* })
|
|
1260
|
+
*
|
|
1261
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1262
|
+
* const state = result // => { currentCount: 6, isIncremental: false }
|
|
1334
1263
|
* ```
|
|
1335
1264
|
*
|
|
1336
|
-
* @category
|
|
1265
|
+
* @category models
|
|
1337
1266
|
* @since 4.0.0
|
|
1338
1267
|
*/
|
|
1339
1268
|
interface Hooks<in Input, out State> {
|
|
@@ -1346,12 +1275,8 @@ export declare namespace Metric {
|
|
|
1346
1275
|
*
|
|
1347
1276
|
* **Example** (Inspecting metric metadata)
|
|
1348
1277
|
*
|
|
1349
|
-
* ```ts
|
|
1350
|
-
* import {
|
|
1351
|
-
*
|
|
1352
|
-
* class MetadataError extends Data.TaggedError("MetadataError")<{
|
|
1353
|
-
* readonly operation: string
|
|
1354
|
-
* }> {}
|
|
1278
|
+
* ```ts import.meta.vitest
|
|
1279
|
+
* import { Effect, Metric } from "effect"
|
|
1355
1280
|
*
|
|
1356
1281
|
* const program = Effect.gen(function*() {
|
|
1357
1282
|
* // Create metrics with different configurations
|
|
@@ -1396,9 +1321,12 @@ export declare namespace Metric {
|
|
|
1396
1321
|
* }
|
|
1397
1322
|
* }
|
|
1398
1323
|
* })
|
|
1324
|
+
*
|
|
1325
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1326
|
+
* const types = [result.counter.type, result.gauge.type, result.frequency.type] // => ["Counter", "Gauge", "Frequency"]
|
|
1399
1327
|
* ```
|
|
1400
1328
|
*
|
|
1401
|
-
* @category
|
|
1329
|
+
* @category models
|
|
1402
1330
|
* @since 4.0.0
|
|
1403
1331
|
*/
|
|
1404
1332
|
interface Metadata<in Input, out State> {
|
|
@@ -1413,12 +1341,8 @@ export declare namespace Metric {
|
|
|
1413
1341
|
*
|
|
1414
1342
|
* **Example** (Inspecting metric snapshot protocols)
|
|
1415
1343
|
*
|
|
1416
|
-
* ```ts
|
|
1417
|
-
* import {
|
|
1418
|
-
*
|
|
1419
|
-
* class SnapshotProtoError extends Data.TaggedError("SnapshotProtoError")<{
|
|
1420
|
-
* readonly operation: string
|
|
1421
|
-
* }> {}
|
|
1344
|
+
* ```ts import.meta.vitest
|
|
1345
|
+
* import { Effect, Metric } from "effect"
|
|
1422
1346
|
*
|
|
1423
1347
|
* const program = Effect.gen(function*() {
|
|
1424
1348
|
* // Create and update metrics
|
|
@@ -1468,9 +1392,12 @@ export declare namespace Metric {
|
|
|
1468
1392
|
* null
|
|
1469
1393
|
* }
|
|
1470
1394
|
* })
|
|
1395
|
+
*
|
|
1396
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1397
|
+
* const counts = [result.counter?.count, result.histogram?.observations] // => [25, 2]
|
|
1471
1398
|
* ```
|
|
1472
1399
|
*
|
|
1473
|
-
* @category
|
|
1400
|
+
* @category models
|
|
1474
1401
|
* @since 4.0.0
|
|
1475
1402
|
*/
|
|
1476
1403
|
interface SnapshotProto<T extends Type, State> {
|
|
@@ -1485,12 +1412,8 @@ export declare namespace Metric {
|
|
|
1485
1412
|
*
|
|
1486
1413
|
* **Example** (Analyzing metric snapshots)
|
|
1487
1414
|
*
|
|
1488
|
-
* ```ts
|
|
1489
|
-
* import {
|
|
1490
|
-
*
|
|
1491
|
-
* class SnapshotError extends Data.TaggedError("SnapshotError")<{
|
|
1492
|
-
* readonly operation: string
|
|
1493
|
-
* }> {}
|
|
1415
|
+
* ```ts import.meta.vitest
|
|
1416
|
+
* import { Effect, Metric } from "effect"
|
|
1494
1417
|
*
|
|
1495
1418
|
* const program = Effect.gen(function*() {
|
|
1496
1419
|
* // Create different types of metrics
|
|
@@ -1544,9 +1467,12 @@ export declare namespace Metric {
|
|
|
1544
1467
|
* analysis
|
|
1545
1468
|
* }
|
|
1546
1469
|
* })
|
|
1470
|
+
*
|
|
1471
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1472
|
+
* const types = result.metricTypes // => ["Counter", "Gauge", "Frequency", "Histogram", "Summary"]
|
|
1547
1473
|
* ```
|
|
1548
1474
|
*
|
|
1549
|
-
* @category
|
|
1475
|
+
* @category models
|
|
1550
1476
|
* @since 4.0.0
|
|
1551
1477
|
*/
|
|
1552
1478
|
type Snapshot = SnapshotProto<"Counter", CounterState<number | bigint>> | SnapshotProto<"Gauge", GaugeState<number | bigint>> | SnapshotProto<"Frequency", FrequencyState> | SnapshotProto<"Histogram", HistogramState> | SnapshotProto<"Summary", SummaryState>;
|
|
@@ -1556,12 +1482,8 @@ export declare namespace Metric {
|
|
|
1556
1482
|
*
|
|
1557
1483
|
* **Example** (Accessing the current metric attributes key)
|
|
1558
1484
|
*
|
|
1559
|
-
* ```ts
|
|
1560
|
-
* import {
|
|
1561
|
-
*
|
|
1562
|
-
* class AttributesKeyError extends Data.TaggedError("AttributesKeyError")<{
|
|
1563
|
-
* readonly operation: string
|
|
1564
|
-
* }> {}
|
|
1485
|
+
* ```ts import.meta.vitest
|
|
1486
|
+
* import { Effect, Metric } from "effect"
|
|
1565
1487
|
*
|
|
1566
1488
|
* const program = Effect.gen(function*() {
|
|
1567
1489
|
* // The key is used internally by the Effect runtime to manage metric attributes
|
|
@@ -1595,9 +1517,12 @@ export declare namespace Metric {
|
|
|
1595
1517
|
* isConstant: key === "effect/Metric/CurrentMetricAttributes" // true
|
|
1596
1518
|
* }
|
|
1597
1519
|
* })
|
|
1520
|
+
*
|
|
1521
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1522
|
+
* const key = result // => { keyValue: "effect/Metric/CurrentMetricAttributes", keyType: "string", isConstant: true }
|
|
1598
1523
|
* ```
|
|
1599
1524
|
*
|
|
1600
|
-
* @category
|
|
1525
|
+
* @category constants
|
|
1601
1526
|
* @since 4.0.0
|
|
1602
1527
|
*/
|
|
1603
1528
|
export declare const CurrentMetricAttributesKey: "effect/Metric/CurrentMetricAttributes";
|
|
@@ -1618,17 +1543,12 @@ export declare const CurrentMetricAttributesKey: "effect/Metric/CurrentMetricAtt
|
|
|
1618
1543
|
*
|
|
1619
1544
|
* **Example** (Providing current metric attributes)
|
|
1620
1545
|
*
|
|
1621
|
-
* ```ts
|
|
1622
|
-
* import {
|
|
1623
|
-
*
|
|
1624
|
-
* class AttributesError extends Data.TaggedError("AttributesError")<{
|
|
1625
|
-
* readonly operation: string
|
|
1626
|
-
* }> {}
|
|
1546
|
+
* ```ts import.meta.vitest
|
|
1547
|
+
* import { Effect, Metric } from "effect"
|
|
1627
1548
|
*
|
|
1628
1549
|
* const program = Effect.gen(function*() {
|
|
1629
1550
|
* // Access current metric attributes
|
|
1630
|
-
*
|
|
1631
|
-
* console.log("Current attributes:", attributes)
|
|
1551
|
+
* yield* Metric.CurrentMetricAttributes
|
|
1632
1552
|
*
|
|
1633
1553
|
* // Set new attributes context
|
|
1634
1554
|
* const newAttributes = { service: "api", version: "1.0" }
|
|
@@ -1643,9 +1563,12 @@ export declare const CurrentMetricAttributesKey: "effect/Metric/CurrentMetricAtt
|
|
|
1643
1563
|
*
|
|
1644
1564
|
* return result
|
|
1645
1565
|
* })
|
|
1566
|
+
*
|
|
1567
|
+
* const attributes = await Effect.runPromise(program)
|
|
1568
|
+
* const actual = attributes // => { service: "api", version: "1.0" }
|
|
1646
1569
|
* ```
|
|
1647
1570
|
*
|
|
1648
|
-
* @category
|
|
1571
|
+
* @category services
|
|
1649
1572
|
* @since 4.0.0
|
|
1650
1573
|
*/
|
|
1651
1574
|
export declare const CurrentMetricAttributes: Context.Reference<Readonly<Record<string, string>>>;
|
|
@@ -1672,7 +1595,7 @@ export declare const CurrentMetricAttributes: Context.Reference<Readonly<Record<
|
|
|
1672
1595
|
* @see {@link snapshot} for reading all registered metrics from the current `Effect` context
|
|
1673
1596
|
* @see {@link snapshotUnsafe} for reading all registered metrics from an explicit `Context`
|
|
1674
1597
|
*
|
|
1675
|
-
* @category
|
|
1598
|
+
* @category services
|
|
1676
1599
|
* @since 4.0.0
|
|
1677
1600
|
*/
|
|
1678
1601
|
export declare const MetricRegistry: Context.Reference<Map<string, Metric.Metadata<any, any>>>;
|
|
@@ -1687,23 +1610,17 @@ declare const TypeId = "~effect/observability/Metric";
|
|
|
1687
1610
|
*
|
|
1688
1611
|
* **Example** (Checking metric values)
|
|
1689
1612
|
*
|
|
1690
|
-
* ```ts
|
|
1613
|
+
* ```ts import.meta.vitest
|
|
1691
1614
|
* import { Metric } from "effect"
|
|
1692
1615
|
*
|
|
1693
|
-
*
|
|
1694
|
-
*
|
|
1695
|
-
* const notAMetric = { name: "fake-metric" }
|
|
1696
|
-
*
|
|
1697
|
-
* console.log(Metric.isMetric(counter)) // true
|
|
1698
|
-
* console.log(Metric.isMetric(gauge)) // true
|
|
1699
|
-
* console.log(Metric.isMetric(notAMetric)) // false
|
|
1700
|
-
* console.log(Metric.isMetric(null)) // false
|
|
1616
|
+
* Metric.isMetric(Metric.counter("requests")) // => true
|
|
1617
|
+
* Metric.isMetric({ name: "requests" }) // => false
|
|
1701
1618
|
* ```
|
|
1702
1619
|
*
|
|
1703
1620
|
* @category guards
|
|
1704
1621
|
* @since 4.0.0
|
|
1705
1622
|
*/
|
|
1706
|
-
export declare const isMetric: (u: unknown) => u is Metric<
|
|
1623
|
+
export declare const isMetric: (u: unknown) => u is Metric<never, unknown>;
|
|
1707
1624
|
/**
|
|
1708
1625
|
* Represents a Counter metric that tracks cumulative numerical values over
|
|
1709
1626
|
* time. Counters can be incremented and decremented and provide a running total
|
|
@@ -1718,12 +1635,8 @@ export declare const isMetric: (u: unknown) => u is Metric<unknown, never>;
|
|
|
1718
1635
|
*
|
|
1719
1636
|
* **Example** (Creating counter metrics)
|
|
1720
1637
|
*
|
|
1721
|
-
* ```ts
|
|
1722
|
-
* import {
|
|
1723
|
-
*
|
|
1724
|
-
* class CounterError extends Data.TaggedError("CounterError")<{
|
|
1725
|
-
* readonly operation: string
|
|
1726
|
-
* }> {}
|
|
1638
|
+
* ```ts import.meta.vitest
|
|
1639
|
+
* import { Effect, Metric } from "effect"
|
|
1727
1640
|
*
|
|
1728
1641
|
* const program = Effect.gen(function*() {
|
|
1729
1642
|
* // Create a basic counter for tracking requests
|
|
@@ -1757,6 +1670,9 @@ export declare const isMetric: (u: unknown) => u is Metric<unknown, never>;
|
|
|
1757
1670
|
*
|
|
1758
1671
|
* return { requestValue, eventValue, bytesValue }
|
|
1759
1672
|
* })
|
|
1673
|
+
*
|
|
1674
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1675
|
+
* const counts = [result.requestValue.count, result.eventValue.count, result.bytesValue.count] // => [6, 1, 1024n]
|
|
1760
1676
|
* ```
|
|
1761
1677
|
*
|
|
1762
1678
|
* @category constructors
|
|
@@ -1777,12 +1693,8 @@ export declare const counter: {
|
|
|
1777
1693
|
*
|
|
1778
1694
|
* **Example** (Creating counter metrics)
|
|
1779
1695
|
*
|
|
1780
|
-
* ```ts
|
|
1781
|
-
* import {
|
|
1782
|
-
*
|
|
1783
|
-
* class CounterError extends Data.TaggedError("CounterError")<{
|
|
1784
|
-
* readonly operation: string
|
|
1785
|
-
* }> {}
|
|
1696
|
+
* ```ts import.meta.vitest
|
|
1697
|
+
* import { Effect, Metric } from "effect"
|
|
1786
1698
|
*
|
|
1787
1699
|
* const program = Effect.gen(function*() {
|
|
1788
1700
|
* // Create a basic counter for tracking requests
|
|
@@ -1816,6 +1728,9 @@ export declare const counter: {
|
|
|
1816
1728
|
*
|
|
1817
1729
|
* return { requestValue, eventValue, bytesValue }
|
|
1818
1730
|
* })
|
|
1731
|
+
*
|
|
1732
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1733
|
+
* const counts = [result.requestValue.count, result.eventValue.count, result.bytesValue.count] // => [6, 1, 1024n]
|
|
1819
1734
|
* ```
|
|
1820
1735
|
*
|
|
1821
1736
|
* @category constructors
|
|
@@ -1841,12 +1756,8 @@ export declare const counter: {
|
|
|
1841
1756
|
*
|
|
1842
1757
|
* **Example** (Creating counter metrics)
|
|
1843
1758
|
*
|
|
1844
|
-
* ```ts
|
|
1845
|
-
* import {
|
|
1846
|
-
*
|
|
1847
|
-
* class CounterError extends Data.TaggedError("CounterError")<{
|
|
1848
|
-
* readonly operation: string
|
|
1849
|
-
* }> {}
|
|
1759
|
+
* ```ts import.meta.vitest
|
|
1760
|
+
* import { Effect, Metric } from "effect"
|
|
1850
1761
|
*
|
|
1851
1762
|
* const program = Effect.gen(function*() {
|
|
1852
1763
|
* // Create a basic counter for tracking requests
|
|
@@ -1880,6 +1791,9 @@ export declare const counter: {
|
|
|
1880
1791
|
*
|
|
1881
1792
|
* return { requestValue, eventValue, bytesValue }
|
|
1882
1793
|
* })
|
|
1794
|
+
*
|
|
1795
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1796
|
+
* const counts = [result.requestValue.count, result.eventValue.count, result.bytesValue.count] // => [6, 1, 1024n]
|
|
1883
1797
|
* ```
|
|
1884
1798
|
*
|
|
1885
1799
|
* @category constructors
|
|
@@ -1909,12 +1823,8 @@ export declare const counter: {
|
|
|
1909
1823
|
*
|
|
1910
1824
|
* **Example** (Creating gauge metrics)
|
|
1911
1825
|
*
|
|
1912
|
-
* ```ts
|
|
1913
|
-
* import {
|
|
1914
|
-
*
|
|
1915
|
-
* class GaugeError extends Data.TaggedError("GaugeError")<{
|
|
1916
|
-
* readonly operation: string
|
|
1917
|
-
* }> {}
|
|
1826
|
+
* ```ts import.meta.vitest
|
|
1827
|
+
* import { Effect, Metric } from "effect"
|
|
1918
1828
|
*
|
|
1919
1829
|
* const program = Effect.gen(function*() {
|
|
1920
1830
|
* // Create a gauge for tracking memory usage
|
|
@@ -1953,6 +1863,9 @@ export declare const counter: {
|
|
|
1953
1863
|
*
|
|
1954
1864
|
* return { memoryValue, cpuValue, diskValue }
|
|
1955
1865
|
* })
|
|
1866
|
+
*
|
|
1867
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1868
|
+
* const values = [result.memoryValue.value, result.cpuValue.value, result.diskValue.value] // => [800, 75, 1024000000n]
|
|
1956
1869
|
* ```
|
|
1957
1870
|
*
|
|
1958
1871
|
* @category constructors
|
|
@@ -1976,12 +1889,8 @@ export declare const gauge: {
|
|
|
1976
1889
|
*
|
|
1977
1890
|
* **Example** (Creating gauge metrics)
|
|
1978
1891
|
*
|
|
1979
|
-
* ```ts
|
|
1980
|
-
* import {
|
|
1981
|
-
*
|
|
1982
|
-
* class GaugeError extends Data.TaggedError("GaugeError")<{
|
|
1983
|
-
* readonly operation: string
|
|
1984
|
-
* }> {}
|
|
1892
|
+
* ```ts import.meta.vitest
|
|
1893
|
+
* import { Effect, Metric } from "effect"
|
|
1985
1894
|
*
|
|
1986
1895
|
* const program = Effect.gen(function*() {
|
|
1987
1896
|
* // Create a gauge for tracking memory usage
|
|
@@ -2020,6 +1929,9 @@ export declare const gauge: {
|
|
|
2020
1929
|
*
|
|
2021
1930
|
* return { memoryValue, cpuValue, diskValue }
|
|
2022
1931
|
* })
|
|
1932
|
+
*
|
|
1933
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
1934
|
+
* const values = [result.memoryValue.value, result.cpuValue.value, result.diskValue.value] // => [800, 75, 1024000000n]
|
|
2023
1935
|
* ```
|
|
2024
1936
|
*
|
|
2025
1937
|
* @category constructors
|
|
@@ -2047,12 +1959,8 @@ export declare const gauge: {
|
|
|
2047
1959
|
*
|
|
2048
1960
|
* **Example** (Creating gauge metrics)
|
|
2049
1961
|
*
|
|
2050
|
-
* ```ts
|
|
2051
|
-
* import {
|
|
2052
|
-
*
|
|
2053
|
-
* class GaugeError extends Data.TaggedError("GaugeError")<{
|
|
2054
|
-
* readonly operation: string
|
|
2055
|
-
* }> {}
|
|
1962
|
+
* ```ts import.meta.vitest
|
|
1963
|
+
* import { Effect, Metric } from "effect"
|
|
2056
1964
|
*
|
|
2057
1965
|
* const program = Effect.gen(function*() {
|
|
2058
1966
|
* // Create a gauge for tracking memory usage
|
|
@@ -2091,6 +1999,9 @@ export declare const gauge: {
|
|
|
2091
1999
|
*
|
|
2092
2000
|
* return { memoryValue, cpuValue, diskValue }
|
|
2093
2001
|
* })
|
|
2002
|
+
*
|
|
2003
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2004
|
+
* const values = [result.memoryValue.value, result.cpuValue.value, result.diskValue.value] // => [800, 75, 1024000000n]
|
|
2094
2005
|
* ```
|
|
2095
2006
|
*
|
|
2096
2007
|
* @category constructors
|
|
@@ -2119,12 +2030,8 @@ export declare const gauge: {
|
|
|
2119
2030
|
*
|
|
2120
2031
|
* **Example** (Creating frequency metrics)
|
|
2121
2032
|
*
|
|
2122
|
-
* ```ts
|
|
2123
|
-
* import {
|
|
2124
|
-
*
|
|
2125
|
-
* class FrequencyError extends Data.TaggedError("FrequencyError")<{
|
|
2126
|
-
* readonly operation: string
|
|
2127
|
-
* }> {}
|
|
2033
|
+
* ```ts import.meta.vitest
|
|
2034
|
+
* import { Effect, Metric } from "effect"
|
|
2128
2035
|
*
|
|
2129
2036
|
* const program = Effect.gen(function*() {
|
|
2130
2037
|
* // Create a frequency metric for HTTP status codes
|
|
@@ -2174,6 +2081,14 @@ export declare const gauge: {
|
|
|
2174
2081
|
*
|
|
2175
2082
|
* return { statusCounts, actionCounts, errorCounts }
|
|
2176
2083
|
* })
|
|
2084
|
+
*
|
|
2085
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2086
|
+
* const counts = [
|
|
2087
|
+
* result.statusCounts.occurrences.get("200"),
|
|
2088
|
+
* result.actionCounts.occurrences.get("login"),
|
|
2089
|
+
* result.errorCounts.occurrences.get("ValidationError")
|
|
2090
|
+
* ]
|
|
2091
|
+
* counts // => [3, 2, 2]
|
|
2177
2092
|
* ```
|
|
2178
2093
|
*
|
|
2179
2094
|
* @category constructors
|
|
@@ -2200,19 +2115,15 @@ export declare const frequency: (name: string, options?: {
|
|
|
2200
2115
|
*
|
|
2201
2116
|
* **Example** (Creating histogram metrics)
|
|
2202
2117
|
*
|
|
2203
|
-
* ```ts
|
|
2204
|
-
* import {
|
|
2205
|
-
*
|
|
2206
|
-
* class HistogramError extends Data.TaggedError("HistogramError")<{
|
|
2207
|
-
* readonly operation: string
|
|
2208
|
-
* }> {}
|
|
2118
|
+
* ```ts import.meta.vitest
|
|
2119
|
+
* import { Effect, Metric } from "effect"
|
|
2209
2120
|
*
|
|
2210
2121
|
* const program = Effect.gen(function*() {
|
|
2211
2122
|
* // Create a histogram for API response times
|
|
2212
2123
|
* const responseTimeHistogram = Metric.histogram("api_response_time", {
|
|
2213
2124
|
* description: "Distribution of API response times in milliseconds",
|
|
2214
2125
|
* boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 10 })
|
|
2215
|
-
* // Creates buckets: 0-50ms, 50-100ms, 100-150ms, ...,
|
|
2126
|
+
* // Creates buckets: 0-50ms, 50-100ms, 100-150ms, ..., 350-400ms, 400ms+
|
|
2216
2127
|
* })
|
|
2217
2128
|
*
|
|
2218
2129
|
* // Create a histogram for request payload sizes
|
|
@@ -2252,6 +2163,10 @@ export declare const frequency: (name: string, options?: {
|
|
|
2252
2163
|
*
|
|
2253
2164
|
* return { responseTimeState, payloadSizeState }
|
|
2254
2165
|
* })
|
|
2166
|
+
*
|
|
2167
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2168
|
+
* const values = [result.responseTimeState.count, result.responseTimeState.sum, result.payloadSizeState.count]
|
|
2169
|
+
* values // => [5, 500, 3]
|
|
2255
2170
|
* ```
|
|
2256
2171
|
*
|
|
2257
2172
|
* @category constructors
|
|
@@ -2280,12 +2195,8 @@ export declare const histogram: (name: string, options: {
|
|
|
2280
2195
|
*
|
|
2281
2196
|
* **Example** (Creating summary metrics)
|
|
2282
2197
|
*
|
|
2283
|
-
* ```ts
|
|
2284
|
-
* import {
|
|
2285
|
-
*
|
|
2286
|
-
* class SummaryError extends Data.TaggedError("SummaryError")<{
|
|
2287
|
-
* readonly operation: string
|
|
2288
|
-
* }> {}
|
|
2198
|
+
* ```ts import.meta.vitest
|
|
2199
|
+
* import { Duration, Effect, Metric } from "effect"
|
|
2289
2200
|
*
|
|
2290
2201
|
* const program = Effect.gen(function*() {
|
|
2291
2202
|
* // Create a summary for API response times
|
|
@@ -2321,24 +2232,16 @@ export declare const histogram: (name: string, options: {
|
|
|
2321
2232
|
* const responseStats = yield* Metric.value(responseTimeSummary)
|
|
2322
2233
|
* const payloadStats = yield* Metric.value(payloadSizeSummary)
|
|
2323
2234
|
*
|
|
2324
|
-
* console.log({
|
|
2325
|
-
* count: responseStats.count,
|
|
2326
|
-
* min: responseStats.min,
|
|
2327
|
-
* max: responseStats.max,
|
|
2328
|
-
* sum: responseStats.sum
|
|
2329
|
-
* }) // { count: 8, min: 82, max: 240, sum: 1155 }
|
|
2330
|
-
*
|
|
2331
|
-
* console.log({
|
|
2332
|
-
* count: payloadStats.count,
|
|
2333
|
-
* min: payloadStats.min,
|
|
2334
|
-
* max: payloadStats.max,
|
|
2335
|
-
* sum: payloadStats.sum
|
|
2336
|
-
* }) // { count: 4, min: 1.2, max: 15.6, sum: 26 }
|
|
2337
|
-
*
|
|
2338
2235
|
* // Both summaries include quantile information for their configured windows.
|
|
2339
2236
|
*
|
|
2340
2237
|
* return { responseStats, payloadStats }
|
|
2341
2238
|
* })
|
|
2239
|
+
*
|
|
2240
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2241
|
+
* const response = result.responseStats
|
|
2242
|
+
* const payload = result.payloadStats
|
|
2243
|
+
* const responseValues = [response.count, response.min, response.max, response.sum] // => [8, 82, 240, 1155]
|
|
2244
|
+
* const payloadValues = [payload.count, payload.min, payload.max, payload.sum] // => [4, 1.2, 15.6, 26]
|
|
2342
2245
|
* ```
|
|
2343
2246
|
*
|
|
2344
2247
|
* @category constructors
|
|
@@ -2372,7 +2275,7 @@ export declare const summary: (name: string, options: {
|
|
|
2372
2275
|
*
|
|
2373
2276
|
* **Example** (Creating summaries with explicit timestamps)
|
|
2374
2277
|
*
|
|
2375
|
-
* ```ts
|
|
2278
|
+
* ```ts import.meta.vitest
|
|
2376
2279
|
* import { Metric } from "effect"
|
|
2377
2280
|
*
|
|
2378
2281
|
* const responseTimesSummary = Metric.summaryWithTimestamp(
|
|
@@ -2384,6 +2287,7 @@ export declare const summary: (name: string, options: {
|
|
|
2384
2287
|
* quantiles: [0.5, 0.9, 0.99] // Calculate 50th, 90th, and 99th quantiles.
|
|
2385
2288
|
* }
|
|
2386
2289
|
* )
|
|
2290
|
+
* const metadata = [responseTimesSummary.id, responseTimesSummary.type] // => ["response_times_summary", "Summary"]
|
|
2387
2291
|
* ```
|
|
2388
2292
|
*
|
|
2389
2293
|
* @category constructors
|
|
@@ -2410,12 +2314,8 @@ export declare const summaryWithTimestamp: (name: string, options: {
|
|
|
2410
2314
|
*
|
|
2411
2315
|
* **Example** (Recording durations with a timer)
|
|
2412
2316
|
*
|
|
2413
|
-
* ```ts
|
|
2414
|
-
* import {
|
|
2415
|
-
*
|
|
2416
|
-
* class TimerError extends Data.TaggedError("TimerError")<{
|
|
2417
|
-
* readonly operation: string
|
|
2418
|
-
* }> {}
|
|
2317
|
+
* ```ts import.meta.vitest
|
|
2318
|
+
* import { Duration, Effect, Metric } from "effect"
|
|
2419
2319
|
*
|
|
2420
2320
|
* // Create a timer metric to track API request durations
|
|
2421
2321
|
* const apiRequestTimer = Metric.timer("api_request_duration", {
|
|
@@ -2429,13 +2329,17 @@ export declare const summaryWithTimestamp: (name: string, options: {
|
|
|
2429
2329
|
* yield* Metric.update(apiRequestTimer, duration)
|
|
2430
2330
|
*
|
|
2431
2331
|
* const state = yield* Metric.value(apiRequestTimer)
|
|
2432
|
-
*
|
|
2332
|
+
* return {
|
|
2433
2333
|
* count: state.count,
|
|
2434
2334
|
* min: state.min,
|
|
2435
2335
|
* max: state.max,
|
|
2436
2336
|
* sum: state.sum
|
|
2437
|
-
* }
|
|
2337
|
+
* }
|
|
2438
2338
|
* })
|
|
2339
|
+
*
|
|
2340
|
+
* await Effect.runPromise(
|
|
2341
|
+
* Effect.provideService(apiOperation, Metric.MetricRegistry, new Map())
|
|
2342
|
+
* ) // => { count: 1, min: 120, max: 120, sum: 120 }
|
|
2439
2343
|
* ```
|
|
2440
2344
|
*
|
|
2441
2345
|
* @category constructors
|
|
@@ -2460,10 +2364,10 @@ export declare const timer: (name: string, options?: {
|
|
|
2460
2364
|
*
|
|
2461
2365
|
* **Example** (Reading metric state)
|
|
2462
2366
|
*
|
|
2463
|
-
* ```ts
|
|
2367
|
+
* ```ts import.meta.vitest
|
|
2464
2368
|
* import { Effect, Metric } from "effect"
|
|
2465
2369
|
*
|
|
2466
|
-
* const requestCounter = Metric.counter("
|
|
2370
|
+
* const requestCounter = Metric.counter("modify_requests")
|
|
2467
2371
|
* const responseTime = Metric.histogram("response_time", {
|
|
2468
2372
|
* boundaries: [100, 500, 1000, 2000]
|
|
2469
2373
|
* })
|
|
@@ -2475,16 +2379,19 @@ export declare const timer: (name: string, options?: {
|
|
|
2475
2379
|
*
|
|
2476
2380
|
* // Get current values
|
|
2477
2381
|
* const counterState = yield* Metric.value(requestCounter)
|
|
2478
|
-
* console.log(`Request count: ${counterState.count}`)
|
|
2479
|
-
*
|
|
2480
2382
|
* const histogramState = yield* Metric.value(responseTime)
|
|
2481
|
-
*
|
|
2383
|
+
* return {
|
|
2384
|
+
* requestCount: counterState.count,
|
|
2482
2385
|
* count: histogramState.count,
|
|
2483
2386
|
* min: histogramState.min,
|
|
2484
2387
|
* max: histogramState.max,
|
|
2485
2388
|
* average: histogramState.sum / histogramState.count
|
|
2486
|
-
* }
|
|
2389
|
+
* }
|
|
2487
2390
|
* })
|
|
2391
|
+
*
|
|
2392
|
+
* await Effect.runPromise(
|
|
2393
|
+
* Effect.provideService(program, Metric.MetricRegistry, new Map())
|
|
2394
|
+
* ) // => { requestCount: 1, count: 1, min: 750, max: 750, average: 750 }
|
|
2488
2395
|
* ```
|
|
2489
2396
|
*
|
|
2490
2397
|
* @category getters
|
|
@@ -2504,7 +2411,7 @@ export declare const value: <Input, State>(self: Metric<Input, State>) => Effect
|
|
|
2504
2411
|
*
|
|
2505
2412
|
* **Example** (Modifying metric values)
|
|
2506
2413
|
*
|
|
2507
|
-
* ```ts
|
|
2414
|
+
* ```ts import.meta.vitest
|
|
2508
2415
|
* import { Effect, Metric } from "effect"
|
|
2509
2416
|
*
|
|
2510
2417
|
* const temperatureGauge = Metric.gauge("temperature")
|
|
@@ -2524,10 +2431,10 @@ export declare const value: <Input, State>(self: Metric<Input, State>) => Effect
|
|
|
2524
2431
|
*
|
|
2525
2432
|
* const temp = yield* Metric.value(temperatureGauge)
|
|
2526
2433
|
* const requests = yield* Metric.value(requestCounter)
|
|
2527
|
-
*
|
|
2528
|
-
* console.log(`Temperature: ${temp.value}°C`) // 22°C
|
|
2529
|
-
* console.log(`Requests: ${requests.count}`) // 15
|
|
2434
|
+
* return [temp.value, requests.count] as const
|
|
2530
2435
|
* })
|
|
2436
|
+
*
|
|
2437
|
+
* await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [22, 15]
|
|
2531
2438
|
* ```
|
|
2532
2439
|
*
|
|
2533
2440
|
* @category mutations
|
|
@@ -2547,7 +2454,7 @@ export declare const modify: {
|
|
|
2547
2454
|
*
|
|
2548
2455
|
* **Example** (Modifying metric values)
|
|
2549
2456
|
*
|
|
2550
|
-
* ```ts
|
|
2457
|
+
* ```ts import.meta.vitest
|
|
2551
2458
|
* import { Effect, Metric } from "effect"
|
|
2552
2459
|
*
|
|
2553
2460
|
* const temperatureGauge = Metric.gauge("temperature")
|
|
@@ -2567,10 +2474,10 @@ export declare const modify: {
|
|
|
2567
2474
|
*
|
|
2568
2475
|
* const temp = yield* Metric.value(temperatureGauge)
|
|
2569
2476
|
* const requests = yield* Metric.value(requestCounter)
|
|
2570
|
-
*
|
|
2571
|
-
* console.log(`Temperature: ${temp.value}°C`) // 22°C
|
|
2572
|
-
* console.log(`Requests: ${requests.count}`) // 15
|
|
2477
|
+
* return [temp.value, requests.count] as const
|
|
2573
2478
|
* })
|
|
2479
|
+
*
|
|
2480
|
+
* await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [22, 15]
|
|
2574
2481
|
* ```
|
|
2575
2482
|
*
|
|
2576
2483
|
* @category mutations
|
|
@@ -2590,7 +2497,7 @@ export declare const modify: {
|
|
|
2590
2497
|
*
|
|
2591
2498
|
* **Example** (Modifying metric values)
|
|
2592
2499
|
*
|
|
2593
|
-
* ```ts
|
|
2500
|
+
* ```ts import.meta.vitest
|
|
2594
2501
|
* import { Effect, Metric } from "effect"
|
|
2595
2502
|
*
|
|
2596
2503
|
* const temperatureGauge = Metric.gauge("temperature")
|
|
@@ -2610,10 +2517,10 @@ export declare const modify: {
|
|
|
2610
2517
|
*
|
|
2611
2518
|
* const temp = yield* Metric.value(temperatureGauge)
|
|
2612
2519
|
* const requests = yield* Metric.value(requestCounter)
|
|
2613
|
-
*
|
|
2614
|
-
* console.log(`Temperature: ${temp.value}°C`) // 22°C
|
|
2615
|
-
* console.log(`Requests: ${requests.count}`) // 15
|
|
2520
|
+
* return [temp.value, requests.count] as const
|
|
2616
2521
|
* })
|
|
2522
|
+
*
|
|
2523
|
+
* await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [22, 15]
|
|
2617
2524
|
* ```
|
|
2618
2525
|
*
|
|
2619
2526
|
* @category mutations
|
|
@@ -2634,7 +2541,7 @@ export declare const modify: {
|
|
|
2634
2541
|
*
|
|
2635
2542
|
* **Example** (Updating metric values)
|
|
2636
2543
|
*
|
|
2637
|
-
* ```ts
|
|
2544
|
+
* ```ts import.meta.vitest
|
|
2638
2545
|
* import { Effect, Metric } from "effect"
|
|
2639
2546
|
*
|
|
2640
2547
|
* const cpuUsage = Metric.gauge("cpu_usage_percent")
|
|
@@ -2662,11 +2569,10 @@ export declare const modify: {
|
|
|
2662
2569
|
* const cpu = yield* Metric.value(cpuUsage)
|
|
2663
2570
|
* const statuses = yield* Metric.value(httpStatus)
|
|
2664
2571
|
* const times = yield* Metric.value(responseTime)
|
|
2665
|
-
*
|
|
2666
|
-
* console.log(`CPU Usage: ${cpu.value}%`)
|
|
2667
|
-
* console.log(`Status 200 count: ${statuses.occurrences.get("200")}`) // 2
|
|
2668
|
-
* console.log(`Response time samples: ${times.count}`) // 3
|
|
2572
|
+
* return [cpu.value, statuses.occurrences.get("200"), times.count] as const
|
|
2669
2573
|
* })
|
|
2574
|
+
*
|
|
2575
|
+
* await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [67.8, 2, 3]
|
|
2670
2576
|
* ```
|
|
2671
2577
|
*
|
|
2672
2578
|
* @category mutations
|
|
@@ -2686,7 +2592,7 @@ export declare const update: {
|
|
|
2686
2592
|
*
|
|
2687
2593
|
* **Example** (Updating metric values)
|
|
2688
2594
|
*
|
|
2689
|
-
* ```ts
|
|
2595
|
+
* ```ts import.meta.vitest
|
|
2690
2596
|
* import { Effect, Metric } from "effect"
|
|
2691
2597
|
*
|
|
2692
2598
|
* const cpuUsage = Metric.gauge("cpu_usage_percent")
|
|
@@ -2714,11 +2620,10 @@ export declare const update: {
|
|
|
2714
2620
|
* const cpu = yield* Metric.value(cpuUsage)
|
|
2715
2621
|
* const statuses = yield* Metric.value(httpStatus)
|
|
2716
2622
|
* const times = yield* Metric.value(responseTime)
|
|
2717
|
-
*
|
|
2718
|
-
* console.log(`CPU Usage: ${cpu.value}%`)
|
|
2719
|
-
* console.log(`Status 200 count: ${statuses.occurrences.get("200")}`) // 2
|
|
2720
|
-
* console.log(`Response time samples: ${times.count}`) // 3
|
|
2623
|
+
* return [cpu.value, statuses.occurrences.get("200"), times.count] as const
|
|
2721
2624
|
* })
|
|
2625
|
+
*
|
|
2626
|
+
* await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [67.8, 2, 3]
|
|
2722
2627
|
* ```
|
|
2723
2628
|
*
|
|
2724
2629
|
* @category mutations
|
|
@@ -2738,7 +2643,7 @@ export declare const update: {
|
|
|
2738
2643
|
*
|
|
2739
2644
|
* **Example** (Updating metric values)
|
|
2740
2645
|
*
|
|
2741
|
-
* ```ts
|
|
2646
|
+
* ```ts import.meta.vitest
|
|
2742
2647
|
* import { Effect, Metric } from "effect"
|
|
2743
2648
|
*
|
|
2744
2649
|
* const cpuUsage = Metric.gauge("cpu_usage_percent")
|
|
@@ -2766,11 +2671,10 @@ export declare const update: {
|
|
|
2766
2671
|
* const cpu = yield* Metric.value(cpuUsage)
|
|
2767
2672
|
* const statuses = yield* Metric.value(httpStatus)
|
|
2768
2673
|
* const times = yield* Metric.value(responseTime)
|
|
2769
|
-
*
|
|
2770
|
-
* console.log(`CPU Usage: ${cpu.value}%`)
|
|
2771
|
-
* console.log(`Status 200 count: ${statuses.occurrences.get("200")}`) // 2
|
|
2772
|
-
* console.log(`Response time samples: ${times.count}`) // 3
|
|
2674
|
+
* return [cpu.value, statuses.occurrences.get("200"), times.count] as const
|
|
2773
2675
|
* })
|
|
2676
|
+
*
|
|
2677
|
+
* await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => [67.8, 2, 3]
|
|
2774
2678
|
* ```
|
|
2775
2679
|
*
|
|
2776
2680
|
* @category mutations
|
|
@@ -2785,36 +2689,30 @@ export declare const update: {
|
|
|
2785
2689
|
*
|
|
2786
2690
|
* **Example** (Mapping metric inputs)
|
|
2787
2691
|
*
|
|
2788
|
-
* ```ts
|
|
2789
|
-
* import {
|
|
2790
|
-
*
|
|
2791
|
-
* class MetricError extends Data.TaggedError("MetricError")<{
|
|
2792
|
-
* readonly operation: string
|
|
2793
|
-
* }> {}
|
|
2692
|
+
* ```ts import.meta.vitest
|
|
2693
|
+
* import { Effect, Metric } from "effect"
|
|
2794
2694
|
*
|
|
2795
|
-
* // Create a histogram that expects Duration values
|
|
2796
2695
|
* const durationHistogram = Metric.histogram("request_duration_ms", {
|
|
2797
2696
|
* description: "Request duration in milliseconds",
|
|
2798
2697
|
* boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 })
|
|
2799
2698
|
* })
|
|
2800
2699
|
*
|
|
2801
|
-
* //
|
|
2802
|
-
* const
|
|
2700
|
+
* // Accept duration strings while recording numeric milliseconds
|
|
2701
|
+
* const durationStringHistogram = Metric.mapInput(
|
|
2803
2702
|
* durationHistogram,
|
|
2804
|
-
* (
|
|
2703
|
+
* (input: string) => Number(input)
|
|
2805
2704
|
* )
|
|
2806
2705
|
*
|
|
2807
2706
|
* const program = Effect.gen(function*() {
|
|
2808
|
-
*
|
|
2809
|
-
* yield* Metric.
|
|
2810
|
-
*
|
|
2811
|
-
* // Get metric value to see the recorded state
|
|
2812
|
-
* const value = yield* Metric.value(numberHistogram)
|
|
2813
|
-
* return value
|
|
2707
|
+
* yield* Metric.update(durationStringHistogram, "250")
|
|
2708
|
+
* return yield* Metric.value(durationStringHistogram)
|
|
2814
2709
|
* })
|
|
2710
|
+
*
|
|
2711
|
+
* const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2712
|
+
* const values = [value.count, value.sum] // => [1, 250]
|
|
2815
2713
|
* ```
|
|
2816
2714
|
*
|
|
2817
|
-
* @category
|
|
2715
|
+
* @category annotations
|
|
2818
2716
|
* @since 2.0.0
|
|
2819
2717
|
*/
|
|
2820
2718
|
export declare const mapInput: {
|
|
@@ -2825,36 +2723,30 @@ export declare const mapInput: {
|
|
|
2825
2723
|
*
|
|
2826
2724
|
* **Example** (Mapping metric inputs)
|
|
2827
2725
|
*
|
|
2828
|
-
* ```ts
|
|
2829
|
-
* import {
|
|
2830
|
-
*
|
|
2831
|
-
* class MetricError extends Data.TaggedError("MetricError")<{
|
|
2832
|
-
* readonly operation: string
|
|
2833
|
-
* }> {}
|
|
2726
|
+
* ```ts import.meta.vitest
|
|
2727
|
+
* import { Effect, Metric } from "effect"
|
|
2834
2728
|
*
|
|
2835
|
-
* // Create a histogram that expects Duration values
|
|
2836
2729
|
* const durationHistogram = Metric.histogram("request_duration_ms", {
|
|
2837
2730
|
* description: "Request duration in milliseconds",
|
|
2838
2731
|
* boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 })
|
|
2839
2732
|
* })
|
|
2840
2733
|
*
|
|
2841
|
-
* //
|
|
2842
|
-
* const
|
|
2734
|
+
* // Accept duration strings while recording numeric milliseconds
|
|
2735
|
+
* const durationStringHistogram = Metric.mapInput(
|
|
2843
2736
|
* durationHistogram,
|
|
2844
|
-
* (
|
|
2737
|
+
* (input: string) => Number(input)
|
|
2845
2738
|
* )
|
|
2846
2739
|
*
|
|
2847
2740
|
* const program = Effect.gen(function*() {
|
|
2848
|
-
*
|
|
2849
|
-
* yield* Metric.
|
|
2850
|
-
*
|
|
2851
|
-
* // Get metric value to see the recorded state
|
|
2852
|
-
* const value = yield* Metric.value(numberHistogram)
|
|
2853
|
-
* return value
|
|
2741
|
+
* yield* Metric.update(durationStringHistogram, "250")
|
|
2742
|
+
* return yield* Metric.value(durationStringHistogram)
|
|
2854
2743
|
* })
|
|
2744
|
+
*
|
|
2745
|
+
* const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2746
|
+
* const values = [value.count, value.sum] // => [1, 250]
|
|
2855
2747
|
* ```
|
|
2856
2748
|
*
|
|
2857
|
-
* @category
|
|
2749
|
+
* @category annotations
|
|
2858
2750
|
* @since 2.0.0
|
|
2859
2751
|
*/
|
|
2860
2752
|
<Input, Input2 extends Input>(f: (input: Input2, context: Context.Context<never>) => Input): <State>(self: Metric<Input, State>) => Metric<Input2, State>;
|
|
@@ -2865,36 +2757,30 @@ export declare const mapInput: {
|
|
|
2865
2757
|
*
|
|
2866
2758
|
* **Example** (Mapping metric inputs)
|
|
2867
2759
|
*
|
|
2868
|
-
* ```ts
|
|
2869
|
-
* import {
|
|
2870
|
-
*
|
|
2871
|
-
* class MetricError extends Data.TaggedError("MetricError")<{
|
|
2872
|
-
* readonly operation: string
|
|
2873
|
-
* }> {}
|
|
2760
|
+
* ```ts import.meta.vitest
|
|
2761
|
+
* import { Effect, Metric } from "effect"
|
|
2874
2762
|
*
|
|
2875
|
-
* // Create a histogram that expects Duration values
|
|
2876
2763
|
* const durationHistogram = Metric.histogram("request_duration_ms", {
|
|
2877
2764
|
* description: "Request duration in milliseconds",
|
|
2878
2765
|
* boundaries: Metric.linearBoundaries({ start: 0, width: 100, count: 10 })
|
|
2879
2766
|
* })
|
|
2880
2767
|
*
|
|
2881
|
-
* //
|
|
2882
|
-
* const
|
|
2768
|
+
* // Accept duration strings while recording numeric milliseconds
|
|
2769
|
+
* const durationStringHistogram = Metric.mapInput(
|
|
2883
2770
|
* durationHistogram,
|
|
2884
|
-
* (
|
|
2771
|
+
* (input: string) => Number(input)
|
|
2885
2772
|
* )
|
|
2886
2773
|
*
|
|
2887
2774
|
* const program = Effect.gen(function*() {
|
|
2888
|
-
*
|
|
2889
|
-
* yield* Metric.
|
|
2890
|
-
*
|
|
2891
|
-
* // Get metric value to see the recorded state
|
|
2892
|
-
* const value = yield* Metric.value(numberHistogram)
|
|
2893
|
-
* return value
|
|
2775
|
+
* yield* Metric.update(durationStringHistogram, "250")
|
|
2776
|
+
* return yield* Metric.value(durationStringHistogram)
|
|
2894
2777
|
* })
|
|
2778
|
+
*
|
|
2779
|
+
* const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2780
|
+
* const values = [value.count, value.sum] // => [1, 250]
|
|
2895
2781
|
* ```
|
|
2896
2782
|
*
|
|
2897
|
-
* @category
|
|
2783
|
+
* @category annotations
|
|
2898
2784
|
* @since 2.0.0
|
|
2899
2785
|
*/
|
|
2900
2786
|
<Input, State, Input2>(self: Metric<Input, State>, f: (input: Input2, context: Context.Context<never>) => Input): Metric<Input2, State>;
|
|
@@ -2906,12 +2792,8 @@ export declare const mapInput: {
|
|
|
2906
2792
|
*
|
|
2907
2793
|
* **Example** (Ignoring inputs with a constant value)
|
|
2908
2794
|
*
|
|
2909
|
-
* ```ts
|
|
2910
|
-
* import {
|
|
2911
|
-
*
|
|
2912
|
-
* class MetricError extends Data.TaggedError("MetricError")<{
|
|
2913
|
-
* readonly operation: string
|
|
2914
|
-
* }> {}
|
|
2795
|
+
* ```ts import.meta.vitest
|
|
2796
|
+
* import { Effect, Metric } from "effect"
|
|
2915
2797
|
*
|
|
2916
2798
|
* // Create a counter that normally expects a number increment
|
|
2917
2799
|
* const requestCounter = Metric.counter("total_requests", {
|
|
@@ -2930,9 +2812,12 @@ export declare const mapInput: {
|
|
|
2930
2812
|
* const value = yield* Metric.value(simpleRequestCounter)
|
|
2931
2813
|
* return value // Counter state will show count: 3
|
|
2932
2814
|
* })
|
|
2815
|
+
*
|
|
2816
|
+
* const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2817
|
+
* const count = value.count // => 3
|
|
2933
2818
|
* ```
|
|
2934
2819
|
*
|
|
2935
|
-
* @category
|
|
2820
|
+
* @category mapping
|
|
2936
2821
|
* @since 2.0.0
|
|
2937
2822
|
*/
|
|
2938
2823
|
export declare const withConstantInput: {
|
|
@@ -2943,12 +2828,8 @@ export declare const withConstantInput: {
|
|
|
2943
2828
|
*
|
|
2944
2829
|
* **Example** (Ignoring inputs with a constant value)
|
|
2945
2830
|
*
|
|
2946
|
-
* ```ts
|
|
2947
|
-
* import {
|
|
2948
|
-
*
|
|
2949
|
-
* class MetricError extends Data.TaggedError("MetricError")<{
|
|
2950
|
-
* readonly operation: string
|
|
2951
|
-
* }> {}
|
|
2831
|
+
* ```ts import.meta.vitest
|
|
2832
|
+
* import { Effect, Metric } from "effect"
|
|
2952
2833
|
*
|
|
2953
2834
|
* // Create a counter that normally expects a number increment
|
|
2954
2835
|
* const requestCounter = Metric.counter("total_requests", {
|
|
@@ -2967,9 +2848,12 @@ export declare const withConstantInput: {
|
|
|
2967
2848
|
* const value = yield* Metric.value(simpleRequestCounter)
|
|
2968
2849
|
* return value // Counter state will show count: 3
|
|
2969
2850
|
* })
|
|
2851
|
+
*
|
|
2852
|
+
* const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2853
|
+
* const count = value.count // => 3
|
|
2970
2854
|
* ```
|
|
2971
2855
|
*
|
|
2972
|
-
* @category
|
|
2856
|
+
* @category mapping
|
|
2973
2857
|
* @since 2.0.0
|
|
2974
2858
|
*/
|
|
2975
2859
|
<Input>(input: Input): <State>(self: Metric<Input, State>) => Metric<unknown, State>;
|
|
@@ -2980,12 +2864,8 @@ export declare const withConstantInput: {
|
|
|
2980
2864
|
*
|
|
2981
2865
|
* **Example** (Ignoring inputs with a constant value)
|
|
2982
2866
|
*
|
|
2983
|
-
* ```ts
|
|
2984
|
-
* import {
|
|
2985
|
-
*
|
|
2986
|
-
* class MetricError extends Data.TaggedError("MetricError")<{
|
|
2987
|
-
* readonly operation: string
|
|
2988
|
-
* }> {}
|
|
2867
|
+
* ```ts import.meta.vitest
|
|
2868
|
+
* import { Effect, Metric } from "effect"
|
|
2989
2869
|
*
|
|
2990
2870
|
* // Create a counter that normally expects a number increment
|
|
2991
2871
|
* const requestCounter = Metric.counter("total_requests", {
|
|
@@ -3004,9 +2884,12 @@ export declare const withConstantInput: {
|
|
|
3004
2884
|
* const value = yield* Metric.value(simpleRequestCounter)
|
|
3005
2885
|
* return value // Counter state will show count: 3
|
|
3006
2886
|
* })
|
|
2887
|
+
*
|
|
2888
|
+
* const value = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
2889
|
+
* const count = value.count // => 3
|
|
3007
2890
|
* ```
|
|
3008
2891
|
*
|
|
3009
|
-
* @category
|
|
2892
|
+
* @category mapping
|
|
3010
2893
|
* @since 2.0.0
|
|
3011
2894
|
*/
|
|
3012
2895
|
<Input, State>(self: Metric<Input, State>, input: Input): Metric<unknown, State>;
|
|
@@ -3022,7 +2905,7 @@ export declare const withConstantInput: {
|
|
|
3022
2905
|
*
|
|
3023
2906
|
* **Example** (Applying metric attributes)
|
|
3024
2907
|
*
|
|
3025
|
-
* ```ts
|
|
2908
|
+
* ```ts import.meta.vitest
|
|
3026
2909
|
* import { Effect, Metric } from "effect"
|
|
3027
2910
|
*
|
|
3028
2911
|
* const requestCounter = Metric.counter("http_requests_total", {
|
|
@@ -3055,18 +2938,17 @@ export declare const withConstantInput: {
|
|
|
3055
2938
|
* yield* Metric.update(taggedMetric, 1) // http_requests_total{service="user-api", version="v1"}
|
|
3056
2939
|
* })
|
|
3057
2940
|
*
|
|
3058
|
-
*
|
|
3059
|
-
*
|
|
3060
|
-
* const
|
|
3061
|
-
*
|
|
3062
|
-
*
|
|
3063
|
-
* console.log(`${metric.id}`, metric.attributes, metric.state)
|
|
3064
|
-
* }
|
|
3065
|
-
* }
|
|
2941
|
+
* const result = Effect.gen(function*() {
|
|
2942
|
+
* yield* program
|
|
2943
|
+
* const get = yield* Metric.value(getRequests)
|
|
2944
|
+
* const post = yield* Metric.value(postRequests)
|
|
2945
|
+
* return [get.count, post.count] as const
|
|
3066
2946
|
* })
|
|
2947
|
+
*
|
|
2948
|
+
* await Effect.runPromise(Effect.provideService(result, Metric.MetricRegistry, new Map())) // => [2, 1]
|
|
3067
2949
|
* ```
|
|
3068
2950
|
*
|
|
3069
|
-
* @category
|
|
2951
|
+
* @category mapping
|
|
3070
2952
|
* @since 4.0.0
|
|
3071
2953
|
*/
|
|
3072
2954
|
export declare const withAttributes: {
|
|
@@ -3081,7 +2963,7 @@ export declare const withAttributes: {
|
|
|
3081
2963
|
*
|
|
3082
2964
|
* **Example** (Applying metric attributes)
|
|
3083
2965
|
*
|
|
3084
|
-
* ```ts
|
|
2966
|
+
* ```ts import.meta.vitest
|
|
3085
2967
|
* import { Effect, Metric } from "effect"
|
|
3086
2968
|
*
|
|
3087
2969
|
* const requestCounter = Metric.counter("http_requests_total", {
|
|
@@ -3114,18 +2996,17 @@ export declare const withAttributes: {
|
|
|
3114
2996
|
* yield* Metric.update(taggedMetric, 1) // http_requests_total{service="user-api", version="v1"}
|
|
3115
2997
|
* })
|
|
3116
2998
|
*
|
|
3117
|
-
*
|
|
3118
|
-
*
|
|
3119
|
-
* const
|
|
3120
|
-
*
|
|
3121
|
-
*
|
|
3122
|
-
* console.log(`${metric.id}`, metric.attributes, metric.state)
|
|
3123
|
-
* }
|
|
3124
|
-
* }
|
|
2999
|
+
* const result = Effect.gen(function*() {
|
|
3000
|
+
* yield* program
|
|
3001
|
+
* const get = yield* Metric.value(getRequests)
|
|
3002
|
+
* const post = yield* Metric.value(postRequests)
|
|
3003
|
+
* return [get.count, post.count] as const
|
|
3125
3004
|
* })
|
|
3005
|
+
*
|
|
3006
|
+
* await Effect.runPromise(Effect.provideService(result, Metric.MetricRegistry, new Map())) // => [2, 1]
|
|
3126
3007
|
* ```
|
|
3127
3008
|
*
|
|
3128
|
-
* @category
|
|
3009
|
+
* @category mapping
|
|
3129
3010
|
* @since 4.0.0
|
|
3130
3011
|
*/
|
|
3131
3012
|
(attributes: Metric.Attributes): <Input, State>(self: Metric<Input, State>) => Metric<Input, State>;
|
|
@@ -3140,7 +3021,7 @@ export declare const withAttributes: {
|
|
|
3140
3021
|
*
|
|
3141
3022
|
* **Example** (Applying metric attributes)
|
|
3142
3023
|
*
|
|
3143
|
-
* ```ts
|
|
3024
|
+
* ```ts import.meta.vitest
|
|
3144
3025
|
* import { Effect, Metric } from "effect"
|
|
3145
3026
|
*
|
|
3146
3027
|
* const requestCounter = Metric.counter("http_requests_total", {
|
|
@@ -3173,18 +3054,17 @@ export declare const withAttributes: {
|
|
|
3173
3054
|
* yield* Metric.update(taggedMetric, 1) // http_requests_total{service="user-api", version="v1"}
|
|
3174
3055
|
* })
|
|
3175
3056
|
*
|
|
3176
|
-
*
|
|
3177
|
-
*
|
|
3178
|
-
* const
|
|
3179
|
-
*
|
|
3180
|
-
*
|
|
3181
|
-
* console.log(`${metric.id}`, metric.attributes, metric.state)
|
|
3182
|
-
* }
|
|
3183
|
-
* }
|
|
3057
|
+
* const result = Effect.gen(function*() {
|
|
3058
|
+
* yield* program
|
|
3059
|
+
* const get = yield* Metric.value(getRequests)
|
|
3060
|
+
* const post = yield* Metric.value(postRequests)
|
|
3061
|
+
* return [get.count, post.count] as const
|
|
3184
3062
|
* })
|
|
3063
|
+
*
|
|
3064
|
+
* await Effect.runPromise(Effect.provideService(result, Metric.MetricRegistry, new Map())) // => [2, 1]
|
|
3185
3065
|
* ```
|
|
3186
3066
|
*
|
|
3187
|
-
* @category
|
|
3067
|
+
* @category mapping
|
|
3188
3068
|
* @since 4.0.0
|
|
3189
3069
|
*/
|
|
3190
3070
|
<Input, State>(self: Metric<Input, State>, attributes: Metric.Attributes): Metric<Input, State>;
|
|
@@ -3199,12 +3079,8 @@ export declare const withAttributes: {
|
|
|
3199
3079
|
*
|
|
3200
3080
|
* **Example** (Capturing metric snapshots)
|
|
3201
3081
|
*
|
|
3202
|
-
* ```ts
|
|
3203
|
-
* import {
|
|
3204
|
-
*
|
|
3205
|
-
* class SnapshotError extends Data.TaggedError("SnapshotError")<{
|
|
3206
|
-
* readonly operation: string
|
|
3207
|
-
* }> {}
|
|
3082
|
+
* ```ts import.meta.vitest
|
|
3083
|
+
* import { Effect, Metric } from "effect"
|
|
3208
3084
|
*
|
|
3209
3085
|
* const program = Effect.gen(function*() {
|
|
3210
3086
|
* // Create and update some metrics
|
|
@@ -3225,19 +3101,16 @@ export declare const withAttributes: {
|
|
|
3225
3101
|
* // Take a snapshot of all metrics
|
|
3226
3102
|
* const snapshots = yield* Metric.snapshot
|
|
3227
3103
|
*
|
|
3228
|
-
* // Examine the snapshots
|
|
3229
|
-
* for (const snapshot of snapshots) {
|
|
3230
|
-
* yield* Console.log(`Metric: ${snapshot.id}`)
|
|
3231
|
-
* yield* Console.log(`Description: ${snapshot.description}`)
|
|
3232
|
-
* yield* Console.log(`Type: ${snapshot.type}`)
|
|
3233
|
-
* yield* Console.log(`State:`, snapshot.state)
|
|
3234
|
-
* }
|
|
3235
|
-
*
|
|
3236
3104
|
* return snapshots
|
|
3237
3105
|
* })
|
|
3106
|
+
*
|
|
3107
|
+
* const snapshots = await Effect.runPromise(
|
|
3108
|
+
* Effect.provideService(program, Metric.MetricRegistry, new Map())
|
|
3109
|
+
* )
|
|
3110
|
+
* const ids = snapshots.map((snapshot) => snapshot.id).sort() // => ["http_requests", "response_time_ms"]
|
|
3238
3111
|
* ```
|
|
3239
3112
|
*
|
|
3240
|
-
* @category
|
|
3113
|
+
* @category snapshotting
|
|
3241
3114
|
* @since 2.0.0
|
|
3242
3115
|
*/
|
|
3243
3116
|
export declare const snapshot: Effect<ReadonlyArray<Metric.Snapshot>>;
|
|
@@ -3253,12 +3126,8 @@ export declare const snapshot: Effect<ReadonlyArray<Metric.Snapshot>>;
|
|
|
3253
3126
|
*
|
|
3254
3127
|
* **Example** (Dumping metrics as text)
|
|
3255
3128
|
*
|
|
3256
|
-
* ```ts
|
|
3257
|
-
* import {
|
|
3258
|
-
*
|
|
3259
|
-
* class DumpError extends Data.TaggedError("DumpError")<{
|
|
3260
|
-
* readonly operation: string
|
|
3261
|
-
* }> {}
|
|
3129
|
+
* ```ts import.meta.vitest
|
|
3130
|
+
* import { Effect, Metric } from "effect"
|
|
3262
3131
|
*
|
|
3263
3132
|
* const program = Effect.gen(function*() {
|
|
3264
3133
|
* // Create and update some metrics for demonstration
|
|
@@ -3282,20 +3151,21 @@ export declare const snapshot: Effect<ReadonlyArray<Metric.Snapshot>>;
|
|
|
3282
3151
|
*
|
|
3283
3152
|
* // Get formatted dump of all metrics
|
|
3284
3153
|
* const metricsReport = yield* Metric.dump
|
|
3285
|
-
* yield* Console.log("Current Metrics:")
|
|
3286
|
-
* yield* Console.log(metricsReport)
|
|
3287
|
-
*
|
|
3288
|
-
* // Output will look like a formatted table:
|
|
3289
|
-
* // Name Description Type State
|
|
3290
|
-
* // http_requests_total Total HTTP requests Counter [count: 2]
|
|
3291
|
-
* // response_time_ms Current response time in milliseconds Gauge [value: 125]
|
|
3292
|
-
* // http_status_codes Frequency of HTTP status codes Frequency [occurrences: 200 -> 2, 404 -> 1]
|
|
3293
|
-
*
|
|
3294
3154
|
* return metricsReport
|
|
3295
3155
|
* })
|
|
3156
|
+
*
|
|
3157
|
+
* const report = await Effect.runPromise(
|
|
3158
|
+
* Effect.provideService(program, Metric.MetricRegistry, new Map())
|
|
3159
|
+
* )
|
|
3160
|
+
* const included = [
|
|
3161
|
+
* report.includes("http_requests_total"),
|
|
3162
|
+
* report.includes("response_time_ms"),
|
|
3163
|
+
* report.includes("http_status_codes")
|
|
3164
|
+
* ]
|
|
3165
|
+
* included // => [true, true, true]
|
|
3296
3166
|
* ```
|
|
3297
3167
|
*
|
|
3298
|
-
* @category
|
|
3168
|
+
* @category formatting
|
|
3299
3169
|
* @since 4.0.0
|
|
3300
3170
|
*/
|
|
3301
3171
|
export declare const dump: Effect<string>;
|
|
@@ -3316,56 +3186,20 @@ export declare const dump: Effect<string>;
|
|
|
3316
3186
|
*
|
|
3317
3187
|
* **Example** (Capturing snapshots from a context)
|
|
3318
3188
|
*
|
|
3319
|
-
* ```ts
|
|
3320
|
-
* import {
|
|
3321
|
-
*
|
|
3322
|
-
* class UnsafeSnapshotError extends Data.TaggedError("UnsafeSnapshotError")<{
|
|
3323
|
-
* readonly operation: string
|
|
3324
|
-
* }> {}
|
|
3325
|
-
*
|
|
3326
|
-
* // Use unsafeSnapshot in performance-critical scenarios or internal implementations
|
|
3327
|
-
* const performanceMetricsExporter = Effect.gen(function*() {
|
|
3328
|
-
* // Create some metrics first
|
|
3329
|
-
* const requestCounter = Metric.counter("http_requests", {
|
|
3330
|
-
* description: "Total HTTP requests"
|
|
3331
|
-
* })
|
|
3332
|
-
* const responseTime = Metric.gauge("response_time_ms", {
|
|
3333
|
-
* description: "Current response time"
|
|
3334
|
-
* })
|
|
3189
|
+
* ```ts import.meta.vitest
|
|
3190
|
+
* import { Effect, Metric } from "effect"
|
|
3335
3191
|
*
|
|
3336
|
-
*
|
|
3192
|
+
* const requestCounter = Metric.counter("http_requests")
|
|
3193
|
+
* const program = Effect.gen(function*() {
|
|
3337
3194
|
* yield* Metric.update(requestCounter, 1)
|
|
3338
|
-
* yield*
|
|
3339
|
-
*
|
|
3340
|
-
* // Get services context for unsafe operations
|
|
3341
|
-
* const services = yield* Effect.context()
|
|
3342
|
-
*
|
|
3343
|
-
* // Use snapshotUnsafe for direct, synchronous access
|
|
3344
|
-
* const snapshots = Metric.snapshotUnsafe(services)
|
|
3345
|
-
* const exportBatchCreatedAt = 1_700_000_000_000
|
|
3346
|
-
*
|
|
3347
|
-
* // Process snapshots immediately (useful for exporters, debugging tools)
|
|
3348
|
-
* const exportData = snapshots.map((snapshot) => ({
|
|
3349
|
-
* name: snapshot.id,
|
|
3350
|
-
* type: snapshot.type,
|
|
3351
|
-
* value: snapshot.state,
|
|
3352
|
-
* timestamp: exportBatchCreatedAt
|
|
3353
|
-
* }))
|
|
3354
|
-
*
|
|
3355
|
-
* // This is synchronous and doesn't involve Effect overhead
|
|
3356
|
-
* // Useful for performance-critical metric export operations
|
|
3357
|
-
* return exportData
|
|
3195
|
+
* const context = yield* Effect.context()
|
|
3196
|
+
* return Metric.snapshotUnsafe(context).map((snapshot) => snapshot.id)
|
|
3358
3197
|
* })
|
|
3359
3198
|
*
|
|
3360
|
-
*
|
|
3361
|
-
* const safeSnapshotExample = Effect.gen(function*() {
|
|
3362
|
-
* // This automatically handles the services context
|
|
3363
|
-
* const snapshots = yield* Metric.snapshot
|
|
3364
|
-
* return snapshots
|
|
3365
|
-
* })
|
|
3199
|
+
* await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map())) // => ["http_requests"]
|
|
3366
3200
|
* ```
|
|
3367
3201
|
*
|
|
3368
|
-
* @category
|
|
3202
|
+
* @category snapshotting
|
|
3369
3203
|
* @since 4.0.0
|
|
3370
3204
|
*/
|
|
3371
3205
|
export declare const snapshotUnsafe: (context: Context.Context<never>) => ReadonlyArray<Metric.Snapshot>;
|
|
@@ -3380,60 +3214,13 @@ export declare const snapshotUnsafe: (context: Context.Context<never>) => Readon
|
|
|
3380
3214
|
*
|
|
3381
3215
|
* **Example** (Creating boundaries from values)
|
|
3382
3216
|
*
|
|
3383
|
-
* ```ts
|
|
3384
|
-
* import {
|
|
3385
|
-
*
|
|
3386
|
-
* class BoundaryError extends Data.TaggedError("BoundaryError")<{
|
|
3387
|
-
* readonly operation: string
|
|
3388
|
-
* }> {}
|
|
3389
|
-
*
|
|
3390
|
-
* // Create boundaries from an array of custom values
|
|
3391
|
-
* const customBoundaries = Metric.boundariesFromIterable([
|
|
3392
|
-
* 10,
|
|
3393
|
-
* 25,
|
|
3394
|
-
* 50,
|
|
3395
|
-
* 100,
|
|
3396
|
-
* 250,
|
|
3397
|
-
* 500,
|
|
3398
|
-
* 1000
|
|
3399
|
-
* ])
|
|
3400
|
-
* console.log(customBoundaries) // [10, 25, 50, 100, 250, 500, 1000, Infinity]
|
|
3401
|
-
*
|
|
3402
|
-
* // Automatically removes duplicates and negative values
|
|
3403
|
-
* const messyBoundaries = Metric.boundariesFromIterable([
|
|
3404
|
-
* -5,
|
|
3405
|
-
* 0,
|
|
3406
|
-
* 10,
|
|
3407
|
-
* 10,
|
|
3408
|
-
* 25,
|
|
3409
|
-
* 25,
|
|
3410
|
-
* 50,
|
|
3411
|
-
* -1
|
|
3412
|
-
* ])
|
|
3413
|
-
* console.log(messyBoundaries) // [10, 25, 50, Infinity]
|
|
3414
|
-
*
|
|
3415
|
-
* // Works with any iterable (Set, generator functions, etc.)
|
|
3416
|
-
* const setBoundaries = Metric.boundariesFromIterable(
|
|
3417
|
-
* new Set([100, 200, 300, 200, 100])
|
|
3418
|
-
* )
|
|
3419
|
-
* console.log(setBoundaries) // [100, 200, 300, Infinity]
|
|
3420
|
-
*
|
|
3421
|
-
* // Use with histogram metric
|
|
3422
|
-
* const responseTimeHistogram = Metric.histogram("response_times", {
|
|
3423
|
-
* description: "API response time distribution",
|
|
3424
|
-
* boundaries: customBoundaries
|
|
3425
|
-
* })
|
|
3426
|
-
*
|
|
3427
|
-
* const program = Effect.gen(function*() {
|
|
3428
|
-
* yield* Metric.update(responseTimeHistogram, 75) // Goes in 50-100ms bucket
|
|
3429
|
-
* yield* Metric.update(responseTimeHistogram, 150) // Goes in 100-250ms bucket
|
|
3217
|
+
* ```ts import.meta.vitest
|
|
3218
|
+
* import { Metric } from "effect"
|
|
3430
3219
|
*
|
|
3431
|
-
*
|
|
3432
|
-
* return value
|
|
3433
|
-
* })
|
|
3220
|
+
* Metric.boundariesFromIterable([-5, 0, 10, 10, 25, 50]) // => [10, 25, 50, Infinity]
|
|
3434
3221
|
* ```
|
|
3435
3222
|
*
|
|
3436
|
-
* @category
|
|
3223
|
+
* @category constructors
|
|
3437
3224
|
* @since 4.0.0
|
|
3438
3225
|
*/
|
|
3439
3226
|
export declare const boundariesFromIterable: (iterable: Iterable<number>) => ReadonlyArray<number>;
|
|
@@ -3443,46 +3230,20 @@ export declare const boundariesFromIterable: (iterable: Iterable<number>) => Rea
|
|
|
3443
3230
|
*
|
|
3444
3231
|
* **Details**
|
|
3445
3232
|
*
|
|
3446
|
-
* Generates `count - 1`
|
|
3233
|
+
* Generates `count - 1` candidate boundaries using `start + index * width` for
|
|
3447
3234
|
* each zero-based index, then applies the same normalization as
|
|
3448
3235
|
* `boundariesFromIterable`: non-positive values are removed, duplicates are
|
|
3449
3236
|
* collapsed, and `Infinity` is appended.
|
|
3450
3237
|
*
|
|
3451
3238
|
* **Example** (Creating linear boundaries)
|
|
3452
3239
|
*
|
|
3453
|
-
* ```ts
|
|
3454
|
-
* import {
|
|
3455
|
-
*
|
|
3456
|
-
* class BoundaryError extends Data.TaggedError("BoundaryError")<{
|
|
3457
|
-
* readonly operation: string
|
|
3458
|
-
* }> {}
|
|
3459
|
-
*
|
|
3460
|
-
* // Create boundaries for response time histogram
|
|
3461
|
-
* const responseBoundaries = Metric.linearBoundaries({
|
|
3462
|
-
* start: 0, // Starting point
|
|
3463
|
-
* width: 100, // Offset used for the first boundary
|
|
3464
|
-
* count: 5 // Creates 4 boundaries + infinity
|
|
3465
|
-
* })
|
|
3466
|
-
* console.log(responseBoundaries) // [100, 101, 102, 103, Infinity]
|
|
3467
|
-
*
|
|
3468
|
-
* // Create a histogram using these boundaries
|
|
3469
|
-
* const responseTimeHistogram = Metric.histogram("api_response_time", {
|
|
3470
|
-
* description: "API response time distribution",
|
|
3471
|
-
* boundaries: responseBoundaries
|
|
3472
|
-
* })
|
|
3473
|
-
*
|
|
3474
|
-
* const program = Effect.gen(function*() {
|
|
3475
|
-
* // Record some response times
|
|
3476
|
-
* yield* Metric.update(responseTimeHistogram, 85)
|
|
3477
|
-
* yield* Metric.update(responseTimeHistogram, 101)
|
|
3478
|
-
* yield* Metric.update(responseTimeHistogram, 450)
|
|
3240
|
+
* ```ts import.meta.vitest
|
|
3241
|
+
* import { Metric } from "effect"
|
|
3479
3242
|
*
|
|
3480
|
-
*
|
|
3481
|
-
* return value
|
|
3482
|
-
* })
|
|
3243
|
+
* Metric.linearBoundaries({ start: 10, width: 20, count: 5 }) // => [10, 30, 50, 70, Infinity]
|
|
3483
3244
|
* ```
|
|
3484
3245
|
*
|
|
3485
|
-
* @category
|
|
3246
|
+
* @category constructors
|
|
3486
3247
|
* @since 4.0.0
|
|
3487
3248
|
*/
|
|
3488
3249
|
export declare const linearBoundaries: (options: {
|
|
@@ -3500,47 +3261,13 @@ export declare const linearBoundaries: (options: {
|
|
|
3500
3261
|
*
|
|
3501
3262
|
* **Example** (Creating exponential boundaries)
|
|
3502
3263
|
*
|
|
3503
|
-
* ```ts
|
|
3504
|
-
* import {
|
|
3505
|
-
*
|
|
3506
|
-
* class BoundaryError extends Data.TaggedError("BoundaryError")<{
|
|
3507
|
-
* readonly operation: string
|
|
3508
|
-
* }> {}
|
|
3509
|
-
*
|
|
3510
|
-
* // Create exponential boundaries for request size histogram
|
|
3511
|
-
* // Buckets: 0-1KB, 1-2KB, 2-4KB, 4-8KB, 8KB+
|
|
3512
|
-
* const sizeBoundaries = Metric.exponentialBoundaries({
|
|
3513
|
-
* start: 1, // Starting at 1KB
|
|
3514
|
-
* factor: 2, // Each boundary doubles the previous
|
|
3515
|
-
* count: 5 // Creates 4 boundaries + infinity
|
|
3516
|
-
* })
|
|
3517
|
-
* console.log(sizeBoundaries) // [1, 2, 4, 8, Infinity]
|
|
3518
|
-
*
|
|
3519
|
-
* // Create a histogram for tracking request payload sizes
|
|
3520
|
-
* const requestSizeHistogram = Metric.histogram("request_size_kb", {
|
|
3521
|
-
* description: "Request payload size distribution in KB",
|
|
3522
|
-
* boundaries: sizeBoundaries
|
|
3523
|
-
* })
|
|
3524
|
-
*
|
|
3525
|
-
* // For very wide ranges, use larger factors
|
|
3526
|
-
* const latencyBoundaries = Metric.exponentialBoundaries({
|
|
3527
|
-
* start: 0.1, // Start at 0.1ms
|
|
3528
|
-
* factor: 10, // Each boundary is 10x larger
|
|
3529
|
-
* count: 6 // Creates ranges: 0.1ms, 1ms, 10ms, 100ms, 1000ms+
|
|
3530
|
-
* })
|
|
3531
|
-
*
|
|
3532
|
-
* const program = Effect.gen(function*() {
|
|
3533
|
-
* // Record different request sizes
|
|
3534
|
-
* yield* Metric.update(requestSizeHistogram, 1.5) // Goes in 1-2KB bucket
|
|
3535
|
-
* yield* Metric.update(requestSizeHistogram, 3.2) // Goes in 2-4KB bucket
|
|
3536
|
-
* yield* Metric.update(requestSizeHistogram, 12) // Goes in 8KB+ bucket
|
|
3264
|
+
* ```ts import.meta.vitest
|
|
3265
|
+
* import { Metric } from "effect"
|
|
3537
3266
|
*
|
|
3538
|
-
*
|
|
3539
|
-
* return value
|
|
3540
|
-
* })
|
|
3267
|
+
* Metric.exponentialBoundaries({ start: 1, factor: 2, count: 5 }) // => [1, 2, 4, 8, Infinity]
|
|
3541
3268
|
* ```
|
|
3542
3269
|
*
|
|
3543
|
-
* @category
|
|
3270
|
+
* @category constructors
|
|
3544
3271
|
* @since 4.0.0
|
|
3545
3272
|
*/
|
|
3546
3273
|
export declare const exponentialBoundaries: (options: {
|
|
@@ -3553,36 +3280,13 @@ export declare const exponentialBoundaries: (options: {
|
|
|
3553
3280
|
*
|
|
3554
3281
|
* **Example** (Accessing the fiber runtime metrics key)
|
|
3555
3282
|
*
|
|
3556
|
-
* ```ts
|
|
3557
|
-
* import {
|
|
3558
|
-
*
|
|
3559
|
-
* class MetricsError extends Data.TaggedError("MetricsError")<{
|
|
3560
|
-
* readonly operation: string
|
|
3561
|
-
* }> {}
|
|
3562
|
-
*
|
|
3563
|
-
* const program = Effect.gen(function*() {
|
|
3564
|
-
* // The key is used internally by the Effect runtime to manage fiber metrics
|
|
3565
|
-
* const key = Metric.FiberRuntimeMetricsKey
|
|
3566
|
-
* console.log("Fiber metrics key:", key)
|
|
3567
|
-
*
|
|
3568
|
-
* // Enable runtime metrics using the key
|
|
3569
|
-
* const layer = Layer.succeed(Metric.FiberRuntimeMetrics)(
|
|
3570
|
-
* Metric.FiberRuntimeMetricsImpl
|
|
3571
|
-
* )
|
|
3572
|
-
*
|
|
3573
|
-
* return yield* Effect.gen(function*() {
|
|
3574
|
-
* // This Effect will have fiber metrics automatically collected
|
|
3575
|
-
* yield* Effect.sleep("100 millis")
|
|
3283
|
+
* ```ts import.meta.vitest
|
|
3284
|
+
* import { Metric } from "effect"
|
|
3576
3285
|
*
|
|
3577
|
-
*
|
|
3578
|
-
* const testCounter = Metric.counter("test_counter")
|
|
3579
|
-
* yield* Metric.update(testCounter, 1)
|
|
3580
|
-
* return yield* Metric.value(testCounter)
|
|
3581
|
-
* }).pipe(Effect.provide(layer))
|
|
3582
|
-
* })
|
|
3286
|
+
* Metric.FiberRuntimeMetricsKey // => "effect/observability/Metric/FiberRuntimeMetricsKey"
|
|
3583
3287
|
* ```
|
|
3584
3288
|
*
|
|
3585
|
-
* @category
|
|
3289
|
+
* @category constants
|
|
3586
3290
|
* @since 4.0.0
|
|
3587
3291
|
*/
|
|
3588
3292
|
export declare const FiberRuntimeMetricsKey: "effect/observability/Metric/FiberRuntimeMetricsKey";
|
|
@@ -3591,38 +3295,25 @@ export declare const FiberRuntimeMetricsKey: "effect/observability/Metric/FiberR
|
|
|
3591
3295
|
*
|
|
3592
3296
|
* **Example** (Providing a custom fiber metrics service)
|
|
3593
3297
|
*
|
|
3594
|
-
* ```ts
|
|
3595
|
-
* import {
|
|
3596
|
-
* import type { Context, Exit } from "effect"
|
|
3298
|
+
* ```ts import.meta.vitest
|
|
3299
|
+
* import { Context, Exit, Metric } from "effect"
|
|
3597
3300
|
*
|
|
3598
|
-
*
|
|
3599
|
-
* readonly operation: string
|
|
3600
|
-
* }> {}
|
|
3601
|
-
*
|
|
3602
|
-
* // Custom implementation of the metrics service
|
|
3301
|
+
* const events: Array<string> = []
|
|
3603
3302
|
* const customMetricsService: Metric.FiberRuntimeMetricsService = {
|
|
3604
|
-
* recordFiberStart: (
|
|
3605
|
-
*
|
|
3606
|
-
* // Custom logic for tracking fiber starts
|
|
3303
|
+
* recordFiberStart: () => {
|
|
3304
|
+
* events.push("start")
|
|
3607
3305
|
* },
|
|
3608
|
-
* recordFiberEnd: (
|
|
3609
|
-
*
|
|
3610
|
-
* exit: Exit.Exit<unknown, unknown>
|
|
3611
|
-
* ) => {
|
|
3612
|
-
* console.log("Fiber completed with exit:", exit)
|
|
3613
|
-
* // Custom logic for tracking fiber completion based on exit status
|
|
3306
|
+
* recordFiberEnd: (_context, exit) => {
|
|
3307
|
+
* events.push(Exit.isSuccess(exit) ? "success" : "failure")
|
|
3614
3308
|
* }
|
|
3615
3309
|
* }
|
|
3616
3310
|
*
|
|
3617
|
-
*
|
|
3618
|
-
*
|
|
3619
|
-
*
|
|
3620
|
-
*
|
|
3621
|
-
* return yield* Effect.sleep("100 millis").pipe(Effect.provide(layer))
|
|
3622
|
-
* })
|
|
3311
|
+
* customMetricsService.recordFiberStart(Context.empty())
|
|
3312
|
+
* customMetricsService.recordFiberEnd(Context.empty(), Exit.succeed("ok"))
|
|
3313
|
+
* events // => ["start", "success"]
|
|
3623
3314
|
* ```
|
|
3624
3315
|
*
|
|
3625
|
-
* @category
|
|
3316
|
+
* @category services
|
|
3626
3317
|
* @since 4.0.0
|
|
3627
3318
|
*/
|
|
3628
3319
|
export interface FiberRuntimeMetricsService {
|
|
@@ -3646,45 +3337,21 @@ export interface FiberRuntimeMetricsService {
|
|
|
3646
3337
|
*
|
|
3647
3338
|
* **Example** (Accessing the fiber runtime metrics service)
|
|
3648
3339
|
*
|
|
3649
|
-
* ```ts
|
|
3650
|
-
* import {
|
|
3651
|
-
*
|
|
3652
|
-
* class MetricsError extends Data.TaggedError("MetricsError")<{
|
|
3653
|
-
* readonly operation: string
|
|
3654
|
-
* }> {}
|
|
3340
|
+
* ```ts import.meta.vitest
|
|
3341
|
+
* import { Effect, Metric } from "effect"
|
|
3655
3342
|
*
|
|
3656
3343
|
* const program = Effect.gen(function*() {
|
|
3657
|
-
* // Access the fiber runtime metrics service
|
|
3658
3344
|
* const metricsService = yield* Metric.FiberRuntimeMetrics
|
|
3659
|
-
*
|
|
3660
|
-
* if (metricsService) {
|
|
3661
|
-
* console.log("Runtime metrics are enabled")
|
|
3662
|
-
* } else {
|
|
3663
|
-
* console.log("Runtime metrics are disabled")
|
|
3664
|
-
* }
|
|
3665
|
-
*
|
|
3666
|
-
* // Enable runtime metrics for the application
|
|
3667
|
-
* const enabledLayer = Metric.enableRuntimeMetricsLayer
|
|
3668
|
-
*
|
|
3669
|
-
* return yield* Effect.gen(function*() {
|
|
3670
|
-
* // Create some concurrent fibers to see metrics in action
|
|
3671
|
-
* yield* Effect.all([
|
|
3672
|
-
* Effect.sleep("100 millis"),
|
|
3673
|
-
* Effect.sleep("200 millis"),
|
|
3674
|
-
* Effect.sleep("300 millis")
|
|
3675
|
-
* ], { concurrency: "unbounded" })
|
|
3676
|
-
*
|
|
3677
|
-
* // Create test metrics to demonstrate the service
|
|
3678
|
-
* const testCounter = Metric.counter("test_counter")
|
|
3679
|
-
* yield* Metric.update(testCounter, 5)
|
|
3680
|
-
* const counterValue = yield* Metric.value(testCounter)
|
|
3681
|
-
*
|
|
3682
|
-
* return { counterValue, metricsEnabled: true }
|
|
3683
|
-
* }).pipe(Effect.provide(enabledLayer))
|
|
3345
|
+
* return metricsService === Metric.FiberRuntimeMetricsImpl
|
|
3684
3346
|
* })
|
|
3347
|
+
*
|
|
3348
|
+
* const result = await Effect.runPromise(
|
|
3349
|
+
* Effect.provideService(program, Metric.FiberRuntimeMetrics, Metric.FiberRuntimeMetricsImpl)
|
|
3350
|
+
* )
|
|
3351
|
+
* const isDefault = result // => true
|
|
3685
3352
|
* ```
|
|
3686
3353
|
*
|
|
3687
|
-
* @category
|
|
3354
|
+
* @category services
|
|
3688
3355
|
* @since 4.0.0
|
|
3689
3356
|
*/
|
|
3690
3357
|
export declare const FiberRuntimeMetrics: Context.Reference<FiberRuntimeMetricsService | undefined>;
|
|
@@ -3693,44 +3360,16 @@ export declare const FiberRuntimeMetrics: Context.Reference<FiberRuntimeMetricsS
|
|
|
3693
3360
|
*
|
|
3694
3361
|
* **Example** (Accessing the default fiber metrics implementation)
|
|
3695
3362
|
*
|
|
3696
|
-
* ```ts
|
|
3697
|
-
* import {
|
|
3698
|
-
*
|
|
3699
|
-
* class MetricsError extends Data.TaggedError("MetricsError")<{
|
|
3700
|
-
* readonly operation: string
|
|
3701
|
-
* }> {}
|
|
3702
|
-
*
|
|
3703
|
-
* const program = Effect.gen(function*() {
|
|
3704
|
-
* // Use the default metrics implementation
|
|
3705
|
-
* const metrics = Metric.FiberRuntimeMetricsImpl
|
|
3706
|
-
* console.log("Metrics implementation:", metrics)
|
|
3707
|
-
*
|
|
3708
|
-
* // Enable runtime metrics using the default implementation
|
|
3709
|
-
* const layer = Layer.succeed(Metric.FiberRuntimeMetrics)(metrics)
|
|
3710
|
-
*
|
|
3711
|
-
* return yield* Effect.gen(function*() {
|
|
3712
|
-
* // Run some Effects to trigger metric collection
|
|
3713
|
-
* yield* Effect.forkChild(Effect.sleep("50 millis"))
|
|
3714
|
-
* yield* Effect.forkChild(Effect.sleep("100 millis"))
|
|
3715
|
-
*
|
|
3716
|
-
* // Wait a bit and check the metrics
|
|
3717
|
-
* yield* Effect.sleep("200 millis")
|
|
3718
|
-
*
|
|
3719
|
-
* // Create test metrics to demonstrate the implementation
|
|
3720
|
-
* const testCounter = Metric.counter("test_counter")
|
|
3721
|
-
* const testGauge = Metric.gauge("test_gauge")
|
|
3722
|
-
* yield* Metric.update(testCounter, 3)
|
|
3723
|
-
* yield* Metric.update(testGauge, 42)
|
|
3724
|
-
*
|
|
3725
|
-
* const counterValue = yield* Metric.value(testCounter)
|
|
3726
|
-
* const gaugeValue = yield* Metric.value(testGauge)
|
|
3363
|
+
* ```ts import.meta.vitest
|
|
3364
|
+
* import { Metric } from "effect"
|
|
3727
3365
|
*
|
|
3728
|
-
*
|
|
3729
|
-
*
|
|
3730
|
-
*
|
|
3366
|
+
* [
|
|
3367
|
+
* typeof Metric.FiberRuntimeMetricsImpl.recordFiberStart,
|
|
3368
|
+
* typeof Metric.FiberRuntimeMetricsImpl.recordFiberEnd
|
|
3369
|
+
* ] // => ["function", "function"]
|
|
3731
3370
|
* ```
|
|
3732
3371
|
*
|
|
3733
|
-
* @category
|
|
3372
|
+
* @category services
|
|
3734
3373
|
* @since 4.0.0
|
|
3735
3374
|
*/
|
|
3736
3375
|
export declare const FiberRuntimeMetricsImpl: FiberRuntimeMetricsService;
|
|
@@ -3745,91 +3384,18 @@ export declare const FiberRuntimeMetricsImpl: FiberRuntimeMetricsService;
|
|
|
3745
3384
|
*
|
|
3746
3385
|
* **Example** (Enabling runtime metrics with a layer)
|
|
3747
3386
|
*
|
|
3748
|
-
* ```ts
|
|
3749
|
-
* import {
|
|
3750
|
-
*
|
|
3751
|
-
* class AppError extends Data.TaggedError("AppError")<{
|
|
3752
|
-
* readonly operation: string
|
|
3753
|
-
* }> {}
|
|
3754
|
-
*
|
|
3755
|
-
* // Define your application logic
|
|
3756
|
-
* const userService = Effect.gen(function*() {
|
|
3757
|
-
* // Simulate user operations with concurrent processing
|
|
3758
|
-
* const fetchUser = (id: number) =>
|
|
3759
|
-
* Effect.gen(function*() {
|
|
3760
|
-
* yield* Effect.sleep(`${50 + id * 10} millis`)
|
|
3761
|
-
* if (id % 7 === 0) {
|
|
3762
|
-
* return yield* new AppError({ operation: `fetch-user-${id}` })
|
|
3763
|
-
* }
|
|
3764
|
-
* return { id, name: `User ${id}`, email: `user${id}@example.com` }
|
|
3765
|
-
* })
|
|
3766
|
-
*
|
|
3767
|
-
* // Process multiple users concurrently (ignoring failures for demo)
|
|
3768
|
-
* const userIds = Array.from({ length: 10 }, (_, i) => i + 1)
|
|
3769
|
-
* const userTasks = userIds.map((id) =>
|
|
3770
|
-
* fetchUser(id).pipe(Effect.catchTag("AppError", () => Effect.succeed(null)))
|
|
3771
|
-
* )
|
|
3772
|
-
* const allUsers = yield* Effect.all(userTasks, { concurrency: 4 })
|
|
3773
|
-
* const successfulUsers = allUsers.filter((user) => user !== null)
|
|
3774
|
-
* return successfulUsers
|
|
3775
|
-
* })
|
|
3776
|
-
*
|
|
3777
|
-
* const analyticsService = Effect.gen(function*() {
|
|
3778
|
-
* // Simulate analytics processing
|
|
3779
|
-
* const tasks = Array.from({ length: 8 }, (_, i) =>
|
|
3780
|
-
* Effect.gen(function*() {
|
|
3781
|
-
* yield* Effect.sleep(`${100 + i * 25} millis`)
|
|
3782
|
-
* return `Analytics task ${i} completed`
|
|
3783
|
-
* }))
|
|
3784
|
-
* return yield* Effect.all(tasks, { concurrency: 3 })
|
|
3785
|
-
* })
|
|
3786
|
-
*
|
|
3787
|
-
* // Main application that uses multiple services
|
|
3788
|
-
* const application = Effect.gen(function*() {
|
|
3789
|
-
* yield* Console.log("Starting application with runtime metrics...")
|
|
3790
|
-
*
|
|
3791
|
-
* // Run services concurrently
|
|
3792
|
-
* const [users, analytics] = yield* Effect.all([
|
|
3793
|
-
* userService,
|
|
3794
|
-
* analyticsService
|
|
3795
|
-
* ], { concurrency: 2 })
|
|
3796
|
-
*
|
|
3797
|
-
* yield* Console.log(
|
|
3798
|
-
* `Processed ${users.length} users and ${analytics.length} analytics tasks`
|
|
3799
|
-
* )
|
|
3800
|
-
*
|
|
3801
|
-
* // Inspect the automatically collected runtime metrics
|
|
3802
|
-
* const metrics = yield* Metric.snapshot
|
|
3803
|
-
* const runtimeMetrics = metrics.filter((m) => m.id.startsWith("child_fiber"))
|
|
3804
|
-
*
|
|
3805
|
-
* yield* Console.log("Runtime Metrics Collected:")
|
|
3806
|
-
* for (const metric of runtimeMetrics) {
|
|
3807
|
-
* yield* Console.log(` ${metric.id}: ${JSON.stringify(metric.state)}`)
|
|
3808
|
-
* }
|
|
3387
|
+
* ```ts import.meta.vitest
|
|
3388
|
+
* import { Effect, Metric } from "effect"
|
|
3809
3389
|
*
|
|
3810
|
-
*
|
|
3390
|
+
* const program = Effect.gen(function*() {
|
|
3391
|
+
* const service = yield* Metric.FiberRuntimeMetrics
|
|
3392
|
+
* return service === Metric.FiberRuntimeMetricsImpl
|
|
3811
3393
|
* })
|
|
3812
3394
|
*
|
|
3813
|
-
*
|
|
3814
|
-
* const AppLayer = Layer.empty // Add your application layers here (database, HTTP, etc.)
|
|
3815
|
-
*
|
|
3816
|
-
* // Add runtime metrics layer at the end
|
|
3817
|
-
* const AppLayerWithMetrics = AppLayer.pipe(
|
|
3818
|
-
* Layer.provide(Metric.enableRuntimeMetricsLayer)
|
|
3819
|
-
* )
|
|
3820
|
-
*
|
|
3821
|
-
* // Run the application with runtime metrics enabled
|
|
3822
|
-
* const program = application.pipe(
|
|
3823
|
-
* Effect.provide(AppLayerWithMetrics)
|
|
3824
|
-
* )
|
|
3825
|
-
*
|
|
3826
|
-
* // Alternative: Provide runtime metrics directly to the application
|
|
3827
|
-
* const programWithDirectMetrics = application.pipe(
|
|
3828
|
-
* Effect.provide(Metric.enableRuntimeMetricsLayer)
|
|
3829
|
-
* )
|
|
3395
|
+
* await Effect.runPromise(Effect.provide(program, Metric.enableRuntimeMetricsLayer)) // => true
|
|
3830
3396
|
* ```
|
|
3831
3397
|
*
|
|
3832
|
-
* @category
|
|
3398
|
+
* @category layers
|
|
3833
3399
|
* @since 4.0.0
|
|
3834
3400
|
*/
|
|
3835
3401
|
export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>;
|
|
@@ -3838,12 +3404,8 @@ export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>
|
|
|
3838
3404
|
*
|
|
3839
3405
|
* **Example** (Disabling runtime metrics with a layer)
|
|
3840
3406
|
*
|
|
3841
|
-
* ```ts
|
|
3842
|
-
* import {
|
|
3843
|
-
*
|
|
3844
|
-
* class MetricsError extends Data.TaggedError("MetricsError")<{
|
|
3845
|
-
* readonly operation: string
|
|
3846
|
-
* }> {}
|
|
3407
|
+
* ```ts import.meta.vitest
|
|
3408
|
+
* import { Effect, Metric } from "effect"
|
|
3847
3409
|
*
|
|
3848
3410
|
* const program = Effect.gen(function*() {
|
|
3849
3411
|
* // Disable runtime metrics collection
|
|
@@ -3852,7 +3414,6 @@ export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>
|
|
|
3852
3414
|
* return yield* Effect.gen(function*() {
|
|
3853
3415
|
* // Check that metrics service is disabled
|
|
3854
3416
|
* const metricsService = yield* Metric.FiberRuntimeMetrics
|
|
3855
|
-
* console.log("Metrics enabled:", metricsService !== undefined) // false
|
|
3856
3417
|
*
|
|
3857
3418
|
* // Run some Effects - no metrics will be collected
|
|
3858
3419
|
* yield* Effect.forkChild(Effect.sleep("50 millis"))
|
|
@@ -3867,9 +3428,12 @@ export declare const enableRuntimeMetricsLayer: Layer.Layer<never, never, never>
|
|
|
3867
3428
|
* return { counterValue, metricsEnabled: metricsService !== undefined }
|
|
3868
3429
|
* }).pipe(Effect.provide(disabledLayer))
|
|
3869
3430
|
* })
|
|
3431
|
+
*
|
|
3432
|
+
* const result = await Effect.runPromise(Effect.provideService(program, Metric.MetricRegistry, new Map()))
|
|
3433
|
+
* const values = [result.counterValue.count, result.metricsEnabled] // => [1, false]
|
|
3870
3434
|
* ```
|
|
3871
3435
|
*
|
|
3872
|
-
* @category
|
|
3436
|
+
* @category layers
|
|
3873
3437
|
* @since 4.0.0
|
|
3874
3438
|
*/
|
|
3875
3439
|
export declare const disableRuntimeMetricsLayer: Layer.Layer<never, never, never>;
|
|
@@ -3884,75 +3448,18 @@ export declare const disableRuntimeMetricsLayer: Layer.Layer<never, never, never
|
|
|
3884
3448
|
*
|
|
3885
3449
|
* **Example** (Enabling runtime metrics for an effect)
|
|
3886
3450
|
*
|
|
3887
|
-
* ```ts
|
|
3888
|
-
* import {
|
|
3889
|
-
*
|
|
3890
|
-
* class RuntimeMetricsError extends Data.TaggedError("RuntimeMetricsError")<{
|
|
3891
|
-
* readonly operation: string
|
|
3892
|
-
* }> {}
|
|
3451
|
+
* ```ts import.meta.vitest
|
|
3452
|
+
* import { Effect, Metric } from "effect"
|
|
3893
3453
|
*
|
|
3894
3454
|
* const program = Effect.gen(function*() {
|
|
3895
|
-
*
|
|
3896
|
-
*
|
|
3897
|
-
* // Simulate concurrent operations
|
|
3898
|
-
* const tasks = Array.from({ length: 10 }, (_, i) =>
|
|
3899
|
-
* Effect.gen(function*() {
|
|
3900
|
-
* yield* Effect.sleep(`${100 + i * 50} millis`)
|
|
3901
|
-
* if (i % 4 === 0) {
|
|
3902
|
-
* // Simulate some failures
|
|
3903
|
-
* return yield* new RuntimeMetricsError({ operation: `task-${i}` })
|
|
3904
|
-
* }
|
|
3905
|
-
* return `Task ${i} completed`
|
|
3906
|
-
* }).pipe(
|
|
3907
|
-
* Effect.catchTag("RuntimeMetricsError", () =>
|
|
3908
|
-
* Effect.succeed(`Task ${i} failed`))
|
|
3909
|
-
* ))
|
|
3910
|
-
*
|
|
3911
|
-
* // Run tasks concurrently
|
|
3912
|
-
* const results = yield* Effect.all(tasks, { concurrency: 5 })
|
|
3913
|
-
* return results
|
|
3914
|
-
* })
|
|
3915
|
-
*
|
|
3916
|
-
* // Enable runtime metrics collection for our workload
|
|
3917
|
-
* const workloadWithMetrics = Metric.enableRuntimeMetrics(heavyWorkload)
|
|
3918
|
-
*
|
|
3919
|
-
* // Execute the workload
|
|
3920
|
-
* const results = yield* workloadWithMetrics
|
|
3921
|
-
*
|
|
3922
|
-
* // After execution, we can inspect the runtime metrics
|
|
3923
|
-
* // The following metrics are automatically collected:
|
|
3924
|
-
* // - child_fibers_active: Current number of active child fibers (Gauge)
|
|
3925
|
-
* // - child_fibers_started: Total child fibers started (Counter, incremental)
|
|
3926
|
-
* // - child_fiber_successes: Total successful child fibers (Counter, incremental)
|
|
3927
|
-
* // - child_fiber_failures: Total failed child fibers (Counter, incremental)
|
|
3928
|
-
*
|
|
3929
|
-
* yield* Console.log(`Workload completed with ${results.length} results`)
|
|
3930
|
-
*
|
|
3931
|
-
* // Get all metrics including the runtime metrics
|
|
3932
|
-
* const allMetrics = yield* Metric.snapshot
|
|
3933
|
-
* const runtimeMetrics = allMetrics.filter((m) =>
|
|
3934
|
-
* m.id.startsWith("child_fiber") || m.id.includes("fiber")
|
|
3935
|
-
* )
|
|
3936
|
-
*
|
|
3937
|
-
* yield* Console.log("Runtime Metrics:")
|
|
3938
|
-
* for (const metric of runtimeMetrics) {
|
|
3939
|
-
* yield* Console.log(` ${metric.id}: ${JSON.stringify(metric.state)}`)
|
|
3940
|
-
* }
|
|
3941
|
-
*
|
|
3942
|
-
* return results
|
|
3455
|
+
* const service = yield* Metric.FiberRuntimeMetrics
|
|
3456
|
+
* return service === Metric.FiberRuntimeMetricsImpl
|
|
3943
3457
|
* })
|
|
3944
3458
|
*
|
|
3945
|
-
*
|
|
3946
|
-
* const BaseAppLayer = Layer.empty // Your base application layers
|
|
3947
|
-
* const AppLayerWithMetrics = BaseAppLayer.pipe(
|
|
3948
|
-
* Layer.provide(Metric.enableRuntimeMetricsLayer)
|
|
3949
|
-
* )
|
|
3950
|
-
* const programWithLayer = program.pipe(
|
|
3951
|
-
* Effect.provide(AppLayerWithMetrics)
|
|
3952
|
-
* )
|
|
3459
|
+
* await Effect.runPromise(Metric.enableRuntimeMetrics(program)) // => true
|
|
3953
3460
|
* ```
|
|
3954
3461
|
*
|
|
3955
|
-
* @category
|
|
3462
|
+
* @category providing services
|
|
3956
3463
|
* @since 4.0.0
|
|
3957
3464
|
*/
|
|
3958
3465
|
export declare const enableRuntimeMetrics: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|
|
@@ -3966,76 +3473,18 @@ export declare const enableRuntimeMetrics: <A, E, R>(self: Effect<A, E, R>) => E
|
|
|
3966
3473
|
*
|
|
3967
3474
|
* **Example** (Disabling runtime metrics for an effect)
|
|
3968
3475
|
*
|
|
3969
|
-
* ```ts
|
|
3970
|
-
* import {
|
|
3971
|
-
*
|
|
3972
|
-
* class DisableMetricsError extends Data.TaggedError("DisableMetricsError")<{
|
|
3973
|
-
* readonly operation: string
|
|
3974
|
-
* }> {}
|
|
3476
|
+
* ```ts import.meta.vitest
|
|
3477
|
+
* import { Effect, Metric } from "effect"
|
|
3975
3478
|
*
|
|
3976
3479
|
* const program = Effect.gen(function*() {
|
|
3977
|
-
*
|
|
3978
|
-
*
|
|
3979
|
-
* const tasks = Array.from({ length: 5 }, (_, i) =>
|
|
3980
|
-
* Effect.gen(function*() {
|
|
3981
|
-
* yield* Effect.sleep(`${100 + i * 20} millis`)
|
|
3982
|
-
* return `Normal task ${i} completed`
|
|
3983
|
-
* }))
|
|
3984
|
-
* return yield* Effect.all(tasks, { concurrency: 3 })
|
|
3985
|
-
* })
|
|
3986
|
-
*
|
|
3987
|
-
* // This section will have runtime metrics disabled for performance
|
|
3988
|
-
* const highPerformanceOperation = Metric.disableRuntimeMetrics(
|
|
3989
|
-
* Effect.gen(function*() {
|
|
3990
|
-
* // Performance-critical code where metrics overhead should be avoided
|
|
3991
|
-
* const hotPath = Array.from(
|
|
3992
|
-
* { length: 1000 },
|
|
3993
|
-
* (_, i) =>
|
|
3994
|
-
* Effect.gen(function*() {
|
|
3995
|
-
* // Simulate intensive computation
|
|
3996
|
-
* const result = i * i + (i % 10) / 10
|
|
3997
|
-
* return result
|
|
3998
|
-
* })
|
|
3999
|
-
* )
|
|
4000
|
-
* return yield* Effect.all(hotPath, { concurrency: 100 })
|
|
4001
|
-
* })
|
|
4002
|
-
* )
|
|
4003
|
-
*
|
|
4004
|
-
* yield* Console.log("Running operations with selective metrics...")
|
|
4005
|
-
*
|
|
4006
|
-
* // Run both operations
|
|
4007
|
-
* const [normalResults, performanceResults] = yield* Effect.all([
|
|
4008
|
-
* normalOperation, // Will generate fiber metrics
|
|
4009
|
-
* highPerformanceOperation // Will NOT generate fiber metrics
|
|
4010
|
-
* ])
|
|
4011
|
-
*
|
|
4012
|
-
* // Check collected metrics - should only see metrics from normalOperation
|
|
4013
|
-
* const metrics = yield* Metric.snapshot
|
|
4014
|
-
* const runtimeMetrics = metrics.filter((m) => m.id.startsWith("child_fiber"))
|
|
4015
|
-
*
|
|
4016
|
-
* yield* Console.log(`Normal operation results: ${normalResults.length}`)
|
|
4017
|
-
* yield* Console.log(
|
|
4018
|
-
* `Performance operation results: ${performanceResults.length}`
|
|
4019
|
-
* )
|
|
4020
|
-
* yield* Console.log(`Runtime metrics collected: ${runtimeMetrics.length}`)
|
|
4021
|
-
*
|
|
4022
|
-
* // The runtime metrics will only reflect the fibers from normalOperation
|
|
4023
|
-
* // The highPerformanceOperation fibers were not tracked due to disableRuntimeMetrics
|
|
4024
|
-
*
|
|
4025
|
-
* return { normalResults, performanceResults, runtimeMetrics }
|
|
3480
|
+
* const service = yield* Metric.FiberRuntimeMetrics
|
|
3481
|
+
* return service === undefined
|
|
4026
3482
|
* })
|
|
4027
3483
|
*
|
|
4028
|
-
*
|
|
4029
|
-
* const BaseAppLayer = Layer.empty // Your base application layers
|
|
4030
|
-
* const AppLayerWithMetrics = BaseAppLayer.pipe(
|
|
4031
|
-
* Layer.provide(Metric.enableRuntimeMetricsLayer)
|
|
4032
|
-
* )
|
|
4033
|
-
* const finalProgram = program.pipe(
|
|
4034
|
-
* Effect.provide(AppLayerWithMetrics)
|
|
4035
|
-
* )
|
|
3484
|
+
* await Effect.runPromise(Metric.disableRuntimeMetrics(program)) // => true
|
|
4036
3485
|
* ```
|
|
4037
3486
|
*
|
|
4038
|
-
* @category
|
|
3487
|
+
* @category providing services
|
|
4039
3488
|
* @since 4.0.0
|
|
4040
3489
|
*/
|
|
4041
3490
|
export declare const disableRuntimeMetrics: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
|