@clayroach/effect 3.19.14-source-capture.6 → 3.19.14-source-capture.8
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/cjs/Utils.js +1 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/clock.js +1 -1
- package/dist/cjs/internal/clock.js.map +1 -1
- package/dist/esm/Utils.js +1 -1
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/clock.js +1 -1
- package/dist/esm/internal/clock.js.map +1 -1
- package/package.json +1 -1
- package/src/Arbitrary.ts +0 -1101
- package/src/Array.ts +0 -3589
- package/src/BigDecimal.ts +0 -1349
- package/src/BigInt.ts +0 -643
- package/src/Boolean.ts +0 -287
- package/src/Brand.ts +0 -360
- package/src/Cache.ts +0 -281
- package/src/Cause.ts +0 -1555
- package/src/Channel.ts +0 -2355
- package/src/ChildExecutorDecision.ts +0 -146
- package/src/Chunk.ts +0 -1495
- package/src/Clock.ts +0 -111
- package/src/Config.ts +0 -542
- package/src/ConfigError.ts +0 -270
- package/src/ConfigProvider.ts +0 -333
- package/src/ConfigProviderPathPatch.ts +0 -100
- package/src/Console.ts +0 -226
- package/src/Context.ts +0 -585
- package/src/Cron.ts +0 -706
- package/src/Data.ts +0 -596
- package/src/DateTime.ts +0 -1686
- package/src/DefaultServices.ts +0 -34
- package/src/Deferred.ts +0 -301
- package/src/Differ.ts +0 -450
- package/src/Duration.ts +0 -1000
- package/src/Effect.ts +0 -14839
- package/src/Effectable.ts +0 -107
- package/src/Either.ts +0 -1040
- package/src/Encoding.ts +0 -195
- package/src/Equal.ts +0 -98
- package/src/Equivalence.ts +0 -235
- package/src/ExecutionPlan.ts +0 -308
- package/src/ExecutionStrategy.ts +0 -119
- package/src/Exit.ts +0 -467
- package/src/FastCheck.ts +0 -9
- package/src/Fiber.ts +0 -744
- package/src/FiberHandle.ts +0 -540
- package/src/FiberId.ts +0 -195
- package/src/FiberMap.ts +0 -656
- package/src/FiberRef.ts +0 -431
- package/src/FiberRefs.ts +0 -204
- package/src/FiberRefsPatch.ts +0 -105
- package/src/FiberSet.ts +0 -491
- package/src/FiberStatus.ts +0 -108
- package/src/Function.ts +0 -1222
- package/src/GlobalValue.ts +0 -53
- package/src/Graph.ts +0 -3732
- package/src/GroupBy.ts +0 -103
- package/src/HKT.ts +0 -45
- package/src/Hash.ts +0 -195
- package/src/HashMap.ts +0 -519
- package/src/HashRing.ts +0 -317
- package/src/HashSet.ts +0 -2346
- package/src/Inspectable.ts +0 -287
- package/src/Iterable.ts +0 -1119
- package/src/JSONSchema.ts +0 -1044
- package/src/KeyedPool.ts +0 -167
- package/src/Layer.ts +0 -1251
- package/src/LayerMap.ts +0 -436
- package/src/List.ts +0 -977
- package/src/LogLevel.ts +0 -285
- package/src/LogSpan.ts +0 -25
- package/src/Logger.ts +0 -702
- package/src/Mailbox.ts +0 -268
- package/src/ManagedRuntime.ts +0 -180
- package/src/Match.ts +0 -1477
- package/src/MergeDecision.ts +0 -95
- package/src/MergeState.ts +0 -172
- package/src/MergeStrategy.ts +0 -107
- package/src/Metric.ts +0 -780
- package/src/MetricBoundaries.ts +0 -69
- package/src/MetricHook.ts +0 -151
- package/src/MetricKey.ts +0 -224
- package/src/MetricKeyType.ts +0 -262
- package/src/MetricLabel.ts +0 -47
- package/src/MetricPair.ts +0 -71
- package/src/MetricPolling.ts +0 -148
- package/src/MetricRegistry.ts +0 -48
- package/src/MetricState.ts +0 -257
- package/src/Micro.ts +0 -4405
- package/src/ModuleVersion.ts +0 -18
- package/src/MutableHashMap.ts +0 -411
- package/src/MutableHashSet.ts +0 -706
- package/src/MutableList.ts +0 -297
- package/src/MutableQueue.ts +0 -227
- package/src/MutableRef.ts +0 -202
- package/src/NonEmptyIterable.ts +0 -32
- package/src/Number.ts +0 -1071
- package/src/Option.ts +0 -2170
- package/src/Order.ts +0 -373
- package/src/Ordering.ts +0 -111
- package/src/ParseResult.ts +0 -2031
- package/src/PartitionedSemaphore.ts +0 -200
- package/src/Pipeable.ts +0 -566
- package/src/Pool.ts +0 -204
- package/src/Predicate.ts +0 -1405
- package/src/Pretty.ts +0 -205
- package/src/PrimaryKey.ts +0 -23
- package/src/PubSub.ts +0 -182
- package/src/Queue.ts +0 -644
- package/src/Random.ts +0 -204
- package/src/RateLimiter.ts +0 -138
- package/src/RcMap.ts +0 -141
- package/src/RcRef.ts +0 -122
- package/src/Readable.ts +0 -93
- package/src/Record.ts +0 -1274
- package/src/RedBlackTree.ts +0 -421
- package/src/Redacted.ts +0 -144
- package/src/Ref.ts +0 -180
- package/src/RegExp.ts +0 -38
- package/src/Reloadable.ts +0 -127
- package/src/Request.ts +0 -347
- package/src/RequestBlock.ts +0 -118
- package/src/RequestResolver.ts +0 -366
- package/src/Resource.ts +0 -119
- package/src/Runtime.ts +0 -383
- package/src/RuntimeFlags.ts +0 -368
- package/src/RuntimeFlagsPatch.ts +0 -183
- package/src/STM.ts +0 -2045
- package/src/Schedule.ts +0 -2219
- package/src/ScheduleDecision.ts +0 -62
- package/src/ScheduleInterval.ts +0 -151
- package/src/ScheduleIntervals.ts +0 -122
- package/src/Scheduler.ts +0 -353
- package/src/Schema.ts +0 -10914
- package/src/SchemaAST.ts +0 -3043
- package/src/Scope.ts +0 -204
- package/src/ScopedCache.ts +0 -151
- package/src/ScopedRef.ts +0 -117
- package/src/Secret.ts +0 -88
- package/src/SingleProducerAsyncInput.ts +0 -67
- package/src/Sink.ts +0 -1461
- package/src/SortedMap.ts +0 -287
- package/src/SortedSet.ts +0 -390
- package/src/Stream.ts +0 -6468
- package/src/StreamEmit.ts +0 -136
- package/src/StreamHaltStrategy.ts +0 -123
- package/src/Streamable.ts +0 -45
- package/src/String.ts +0 -778
- package/src/Struct.ts +0 -243
- package/src/Subscribable.ts +0 -100
- package/src/SubscriptionRef.ts +0 -298
- package/src/Supervisor.ts +0 -240
- package/src/Symbol.ts +0 -29
- package/src/SynchronizedRef.ts +0 -270
- package/src/TArray.ts +0 -495
- package/src/TDeferred.ts +0 -100
- package/src/TMap.ts +0 -515
- package/src/TPriorityQueue.ts +0 -223
- package/src/TPubSub.ts +0 -200
- package/src/TQueue.ts +0 -432
- package/src/TRandom.ts +0 -129
- package/src/TReentrantLock.ts +0 -224
- package/src/TRef.ts +0 -178
- package/src/TSemaphore.ts +0 -129
- package/src/TSet.ts +0 -365
- package/src/TSubscriptionRef.ts +0 -192
- package/src/Take.ts +0 -258
- package/src/TestAnnotation.ts +0 -158
- package/src/TestAnnotationMap.ts +0 -119
- package/src/TestAnnotations.ts +0 -117
- package/src/TestClock.ts +0 -556
- package/src/TestConfig.ts +0 -47
- package/src/TestContext.ts +0 -36
- package/src/TestLive.ts +0 -53
- package/src/TestServices.ts +0 -390
- package/src/TestSized.ts +0 -55
- package/src/Tracer.ts +0 -198
- package/src/Trie.ts +0 -840
- package/src/Tuple.ts +0 -305
- package/src/Types.ts +0 -353
- package/src/Unify.ts +0 -113
- package/src/UpstreamPullRequest.ts +0 -117
- package/src/UpstreamPullStrategy.ts +0 -121
- package/src/Utils.ts +0 -809
- package/src/index.ts +0 -1561
- package/src/internal/array.ts +0 -8
- package/src/internal/blockedRequests.ts +0 -520
- package/src/internal/cache.ts +0 -733
- package/src/internal/cause.ts +0 -1050
- package/src/internal/channel/channelExecutor.ts +0 -1200
- package/src/internal/channel/channelState.ts +0 -134
- package/src/internal/channel/childExecutorDecision.ts +0 -96
- package/src/internal/channel/continuation.ts +0 -200
- package/src/internal/channel/mergeDecision.ts +0 -113
- package/src/internal/channel/mergeState.ts +0 -120
- package/src/internal/channel/mergeStrategy.ts +0 -72
- package/src/internal/channel/singleProducerAsyncInput.ts +0 -259
- package/src/internal/channel/subexecutor.ts +0 -229
- package/src/internal/channel/upstreamPullRequest.ts +0 -84
- package/src/internal/channel/upstreamPullStrategy.ts +0 -87
- package/src/internal/channel.ts +0 -2603
- package/src/internal/clock.ts +0 -95
- package/src/internal/completedRequestMap.ts +0 -9
- package/src/internal/concurrency.ts +0 -54
- package/src/internal/config.ts +0 -716
- package/src/internal/configError.ts +0 -304
- package/src/internal/configProvider/pathPatch.ts +0 -97
- package/src/internal/configProvider.ts +0 -799
- package/src/internal/console.ts +0 -153
- package/src/internal/context.ts +0 -337
- package/src/internal/core-effect.ts +0 -2293
- package/src/internal/core-stream.ts +0 -998
- package/src/internal/core.ts +0 -3273
- package/src/internal/data.ts +0 -36
- package/src/internal/dataSource.ts +0 -327
- package/src/internal/dateTime.ts +0 -1277
- package/src/internal/defaultServices/console.ts +0 -100
- package/src/internal/defaultServices.ts +0 -163
- package/src/internal/deferred.ts +0 -46
- package/src/internal/differ/chunkPatch.ts +0 -211
- package/src/internal/differ/contextPatch.ts +0 -232
- package/src/internal/differ/hashMapPatch.ts +0 -220
- package/src/internal/differ/hashSetPatch.ts +0 -176
- package/src/internal/differ/orPatch.ts +0 -311
- package/src/internal/differ/readonlyArrayPatch.ts +0 -210
- package/src/internal/differ.ts +0 -200
- package/src/internal/doNotation.ts +0 -80
- package/src/internal/effect/circular.ts +0 -905
- package/src/internal/effectable.ts +0 -131
- package/src/internal/either.ts +0 -110
- package/src/internal/encoding/base64.ts +0 -286
- package/src/internal/encoding/base64Url.ts +0 -29
- package/src/internal/encoding/common.ts +0 -51
- package/src/internal/encoding/hex.ts +0 -315
- package/src/internal/errors.ts +0 -7
- package/src/internal/executionPlan.ts +0 -114
- package/src/internal/executionStrategy.ts +0 -74
- package/src/internal/fiber.ts +0 -388
- package/src/internal/fiberId.ts +0 -267
- package/src/internal/fiberMessage.ts +0 -82
- package/src/internal/fiberRefs/patch.ts +0 -144
- package/src/internal/fiberRefs.ts +0 -297
- package/src/internal/fiberRuntime.ts +0 -3915
- package/src/internal/fiberScope.ts +0 -71
- package/src/internal/fiberStatus.ts +0 -119
- package/src/internal/groupBy.ts +0 -530
- package/src/internal/hashMap/array.ts +0 -49
- package/src/internal/hashMap/bitwise.ts +0 -32
- package/src/internal/hashMap/config.ts +0 -14
- package/src/internal/hashMap/keySet.ts +0 -8
- package/src/internal/hashMap/node.ts +0 -391
- package/src/internal/hashMap.ts +0 -586
- package/src/internal/hashSet.ts +0 -323
- package/src/internal/keyedPool.ts +0 -244
- package/src/internal/layer/circular.ts +0 -228
- package/src/internal/layer.ts +0 -1487
- package/src/internal/logSpan.ts +0 -20
- package/src/internal/logger-circular.ts +0 -24
- package/src/internal/logger.ts +0 -485
- package/src/internal/mailbox.ts +0 -561
- package/src/internal/managedRuntime/circular.ts +0 -6
- package/src/internal/managedRuntime.ts +0 -134
- package/src/internal/matcher.ts +0 -652
- package/src/internal/metric/boundaries.ts +0 -75
- package/src/internal/metric/hook.ts +0 -483
- package/src/internal/metric/key.ts +0 -167
- package/src/internal/metric/keyType.ts +0 -238
- package/src/internal/metric/label.ts +0 -41
- package/src/internal/metric/pair.ts +0 -48
- package/src/internal/metric/polling.ts +0 -149
- package/src/internal/metric/registry.ts +0 -187
- package/src/internal/metric/state.ts +0 -290
- package/src/internal/metric.ts +0 -577
- package/src/internal/opCodes/cause.ts +0 -35
- package/src/internal/opCodes/channel.ts +0 -83
- package/src/internal/opCodes/channelChildExecutorDecision.ts +0 -17
- package/src/internal/opCodes/channelMergeDecision.ts +0 -11
- package/src/internal/opCodes/channelMergeState.ts +0 -17
- package/src/internal/opCodes/channelMergeStrategy.ts +0 -11
- package/src/internal/opCodes/channelState.ts +0 -23
- package/src/internal/opCodes/channelUpstreamPullRequest.ts +0 -11
- package/src/internal/opCodes/channelUpstreamPullStrategy.ts +0 -11
- package/src/internal/opCodes/config.ts +0 -65
- package/src/internal/opCodes/configError.ts +0 -35
- package/src/internal/opCodes/continuation.ts +0 -11
- package/src/internal/opCodes/deferred.ts +0 -11
- package/src/internal/opCodes/effect.ts +0 -89
- package/src/internal/opCodes/layer.ts +0 -59
- package/src/internal/opCodes/streamHaltStrategy.ts +0 -23
- package/src/internal/option.ts +0 -80
- package/src/internal/pool.ts +0 -432
- package/src/internal/pubsub.ts +0 -1762
- package/src/internal/query.ts +0 -204
- package/src/internal/queue.ts +0 -766
- package/src/internal/random.ts +0 -161
- package/src/internal/rateLimiter.ts +0 -93
- package/src/internal/rcMap.ts +0 -285
- package/src/internal/rcRef.ts +0 -192
- package/src/internal/redBlackTree/iterator.ts +0 -200
- package/src/internal/redBlackTree/node.ts +0 -68
- package/src/internal/redBlackTree.ts +0 -1245
- package/src/internal/redacted.ts +0 -73
- package/src/internal/ref.ts +0 -171
- package/src/internal/reloadable.ts +0 -140
- package/src/internal/request.ts +0 -177
- package/src/internal/resource.ts +0 -76
- package/src/internal/ringBuffer.ts +0 -68
- package/src/internal/runtime.ts +0 -558
- package/src/internal/runtimeFlags.ts +0 -188
- package/src/internal/runtimeFlagsPatch.ts +0 -103
- package/src/internal/schedule/decision.ts +0 -47
- package/src/internal/schedule/interval.ts +0 -101
- package/src/internal/schedule/intervals.ts +0 -180
- package/src/internal/schedule.ts +0 -2199
- package/src/internal/schema/errors.ts +0 -191
- package/src/internal/schema/schemaId.ts +0 -106
- package/src/internal/schema/util.ts +0 -50
- package/src/internal/scopedCache.ts +0 -644
- package/src/internal/scopedRef.ts +0 -118
- package/src/internal/secret.ts +0 -89
- package/src/internal/singleShotGen.ts +0 -35
- package/src/internal/sink.ts +0 -2120
- package/src/internal/stack.ts +0 -10
- package/src/internal/stm/core.ts +0 -817
- package/src/internal/stm/entry.ts +0 -59
- package/src/internal/stm/journal.ts +0 -123
- package/src/internal/stm/opCodes/stm.ts +0 -71
- package/src/internal/stm/opCodes/stmState.ts +0 -17
- package/src/internal/stm/opCodes/strategy.ts +0 -17
- package/src/internal/stm/opCodes/tExit.ts +0 -29
- package/src/internal/stm/opCodes/tryCommit.ts +0 -11
- package/src/internal/stm/stm.ts +0 -1453
- package/src/internal/stm/stmState.ts +0 -136
- package/src/internal/stm/tArray.ts +0 -550
- package/src/internal/stm/tDeferred.ts +0 -81
- package/src/internal/stm/tExit.ts +0 -190
- package/src/internal/stm/tMap.ts +0 -824
- package/src/internal/stm/tPriorityQueue.ts +0 -267
- package/src/internal/stm/tPubSub.ts +0 -551
- package/src/internal/stm/tQueue.ts +0 -393
- package/src/internal/stm/tRandom.ts +0 -140
- package/src/internal/stm/tReentrantLock.ts +0 -352
- package/src/internal/stm/tRef.ts +0 -195
- package/src/internal/stm/tSemaphore.ts +0 -113
- package/src/internal/stm/tSet.ts +0 -259
- package/src/internal/stm/tSubscriptionRef.ts +0 -286
- package/src/internal/stm/tryCommit.ts +0 -34
- package/src/internal/stm/txnId.ts +0 -14
- package/src/internal/stm/versioned.ts +0 -4
- package/src/internal/stream/debounceState.ts +0 -57
- package/src/internal/stream/emit.ts +0 -123
- package/src/internal/stream/haltStrategy.ts +0 -94
- package/src/internal/stream/handoff.ts +0 -187
- package/src/internal/stream/handoffSignal.ts +0 -59
- package/src/internal/stream/pull.ts +0 -34
- package/src/internal/stream/sinkEndReason.ts +0 -30
- package/src/internal/stream/zipAllState.ts +0 -88
- package/src/internal/stream/zipChunksState.ts +0 -56
- package/src/internal/stream.ts +0 -8801
- package/src/internal/string-utils.ts +0 -107
- package/src/internal/subscriptionRef.ts +0 -138
- package/src/internal/supervisor/patch.ts +0 -190
- package/src/internal/supervisor.ts +0 -303
- package/src/internal/synchronizedRef.ts +0 -114
- package/src/internal/take.ts +0 -199
- package/src/internal/testing/sleep.ts +0 -27
- package/src/internal/testing/suspendedWarningData.ts +0 -85
- package/src/internal/testing/warningData.ts +0 -94
- package/src/internal/tracer.ts +0 -293
- package/src/internal/trie.ts +0 -722
- package/src/internal/version.ts +0 -7
package/src/internal/metric.ts
DELETED
|
@@ -1,577 +0,0 @@
|
|
|
1
|
-
import * as Arr from "../Array.js"
|
|
2
|
-
import * as Clock from "../Clock.js"
|
|
3
|
-
import * as Duration from "../Duration.js"
|
|
4
|
-
import type * as Effect from "../Effect.js"
|
|
5
|
-
import type { LazyArg } from "../Function.js"
|
|
6
|
-
import { constVoid, dual, identity, pipe } from "../Function.js"
|
|
7
|
-
import { globalValue } from "../GlobalValue.js"
|
|
8
|
-
import type * as Metric from "../Metric.js"
|
|
9
|
-
import type * as MetricBoundaries from "../MetricBoundaries.js"
|
|
10
|
-
import type * as MetricHook from "../MetricHook.js"
|
|
11
|
-
import type * as MetricKey from "../MetricKey.js"
|
|
12
|
-
import type * as MetricKeyType from "../MetricKeyType.js"
|
|
13
|
-
import type * as MetricLabel from "../MetricLabel.js"
|
|
14
|
-
import type * as MetricPair from "../MetricPair.js"
|
|
15
|
-
import type * as MetricRegistry from "../MetricRegistry.js"
|
|
16
|
-
import type * as MetricState from "../MetricState.js"
|
|
17
|
-
import { pipeArguments } from "../Pipeable.js"
|
|
18
|
-
import * as Cause from "./cause.js"
|
|
19
|
-
import * as effect_ from "./core-effect.js"
|
|
20
|
-
import * as core from "./core.js"
|
|
21
|
-
import * as metricBoundaries from "./metric/boundaries.js"
|
|
22
|
-
import * as metricKey from "./metric/key.js"
|
|
23
|
-
import * as metricKeyType from "./metric/keyType.js"
|
|
24
|
-
import * as metricLabel from "./metric/label.js"
|
|
25
|
-
import * as metricRegistry from "./metric/registry.js"
|
|
26
|
-
|
|
27
|
-
/** @internal */
|
|
28
|
-
const MetricSymbolKey = "effect/Metric"
|
|
29
|
-
|
|
30
|
-
/** @internal */
|
|
31
|
-
export const MetricTypeId: Metric.MetricTypeId = Symbol.for(
|
|
32
|
-
MetricSymbolKey
|
|
33
|
-
) as Metric.MetricTypeId
|
|
34
|
-
|
|
35
|
-
const metricVariance = {
|
|
36
|
-
/* c8 ignore next */
|
|
37
|
-
_Type: (_: any) => _,
|
|
38
|
-
/* c8 ignore next */
|
|
39
|
-
_In: (_: unknown) => _,
|
|
40
|
-
/* c8 ignore next */
|
|
41
|
-
_Out: (_: never) => _
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** @internal */
|
|
45
|
-
export const globalMetricRegistry: MetricRegistry.MetricRegistry = globalValue(
|
|
46
|
-
Symbol.for("effect/Metric/globalMetricRegistry"),
|
|
47
|
-
() => metricRegistry.make()
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
/** @internal */
|
|
51
|
-
export const make: Metric.MetricApply = function<Type, In, Out>(
|
|
52
|
-
keyType: Type,
|
|
53
|
-
unsafeUpdate: (input: In, extraTags: ReadonlyArray<MetricLabel.MetricLabel>) => void,
|
|
54
|
-
unsafeValue: (extraTags: ReadonlyArray<MetricLabel.MetricLabel>) => Out,
|
|
55
|
-
unsafeModify: (input: In, extraTags: ReadonlyArray<MetricLabel.MetricLabel>) => void
|
|
56
|
-
): Metric.Metric<Type, In, Out> {
|
|
57
|
-
const metric: Metric.Metric<Type, In, Out> = Object.assign(
|
|
58
|
-
<A extends In, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
59
|
-
core.tap(effect, (a) => update(metric, a)),
|
|
60
|
-
{
|
|
61
|
-
[MetricTypeId]: metricVariance,
|
|
62
|
-
keyType,
|
|
63
|
-
unsafeUpdate,
|
|
64
|
-
unsafeValue,
|
|
65
|
-
unsafeModify,
|
|
66
|
-
register() {
|
|
67
|
-
this.unsafeValue([])
|
|
68
|
-
return this as any
|
|
69
|
-
},
|
|
70
|
-
pipe() {
|
|
71
|
-
return pipeArguments(this, arguments)
|
|
72
|
-
}
|
|
73
|
-
} as const
|
|
74
|
-
)
|
|
75
|
-
return metric
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** @internal */
|
|
79
|
-
export const mapInput = dual<
|
|
80
|
-
<In, In2>(f: (input: In2) => In) => <Type, Out>(self: Metric.Metric<Type, In, Out>) => Metric.Metric<Type, In2, Out>,
|
|
81
|
-
<Type, In, Out, In2>(self: Metric.Metric<Type, In, Out>, f: (input: In2) => In) => Metric.Metric<Type, In2, Out>
|
|
82
|
-
>(2, (self, f) =>
|
|
83
|
-
make(
|
|
84
|
-
self.keyType,
|
|
85
|
-
(input, extraTags) => self.unsafeUpdate(f(input), extraTags),
|
|
86
|
-
self.unsafeValue,
|
|
87
|
-
(input, extraTags) => self.unsafeModify(f(input), extraTags)
|
|
88
|
-
))
|
|
89
|
-
|
|
90
|
-
/** @internal */
|
|
91
|
-
export const counter: {
|
|
92
|
-
(name: string, options?: {
|
|
93
|
-
readonly description?: string | undefined
|
|
94
|
-
readonly bigint?: false | undefined
|
|
95
|
-
readonly incremental?: boolean | undefined
|
|
96
|
-
}): Metric.Metric.Counter<number>
|
|
97
|
-
(name: string, options: {
|
|
98
|
-
readonly description?: string | undefined
|
|
99
|
-
readonly bigint: true
|
|
100
|
-
readonly incremental?: boolean | undefined
|
|
101
|
-
}): Metric.Metric.Counter<bigint>
|
|
102
|
-
} = (name, options) => fromMetricKey(metricKey.counter(name, options as any)) as any
|
|
103
|
-
|
|
104
|
-
/** @internal */
|
|
105
|
-
export const frequency = (name: string, options?: {
|
|
106
|
-
readonly description?: string | undefined
|
|
107
|
-
readonly preregisteredWords?: ReadonlyArray<string> | undefined
|
|
108
|
-
}): Metric.Metric.Frequency<string> => fromMetricKey(metricKey.frequency(name, options))
|
|
109
|
-
|
|
110
|
-
/** @internal */
|
|
111
|
-
export const withConstantInput = dual<
|
|
112
|
-
<In>(input: In) => <Type, Out>(self: Metric.Metric<Type, In, Out>) => Metric.Metric<Type, unknown, Out>,
|
|
113
|
-
<Type, In, Out>(self: Metric.Metric<Type, In, Out>, input: In) => Metric.Metric<Type, unknown, Out>
|
|
114
|
-
>(2, (self, input) => mapInput(self, () => input))
|
|
115
|
-
|
|
116
|
-
/** @internal */
|
|
117
|
-
export const fromMetricKey = <Type extends MetricKeyType.MetricKeyType<any, any>>(
|
|
118
|
-
key: MetricKey.MetricKey<Type>
|
|
119
|
-
): Metric.Metric<
|
|
120
|
-
Type,
|
|
121
|
-
MetricKeyType.MetricKeyType.InType<Type>,
|
|
122
|
-
MetricKeyType.MetricKeyType.OutType<Type>
|
|
123
|
-
> => {
|
|
124
|
-
let untaggedHook:
|
|
125
|
-
| MetricHook.MetricHook<
|
|
126
|
-
MetricKeyType.MetricKeyType.InType<Type>,
|
|
127
|
-
MetricKeyType.MetricKeyType.OutType<Type>
|
|
128
|
-
>
|
|
129
|
-
| undefined
|
|
130
|
-
const hookCache = new WeakMap<ReadonlyArray<MetricLabel.MetricLabel>, MetricHook.MetricHook<any, any>>()
|
|
131
|
-
|
|
132
|
-
const hook = (extraTags: ReadonlyArray<MetricLabel.MetricLabel>): MetricHook.MetricHook<
|
|
133
|
-
MetricKeyType.MetricKeyType.InType<Type>,
|
|
134
|
-
MetricKeyType.MetricKeyType.OutType<Type>
|
|
135
|
-
> => {
|
|
136
|
-
if (extraTags.length === 0) {
|
|
137
|
-
if (untaggedHook !== undefined) {
|
|
138
|
-
return untaggedHook
|
|
139
|
-
}
|
|
140
|
-
untaggedHook = globalMetricRegistry.get(key)
|
|
141
|
-
return untaggedHook
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
let hook = hookCache.get(extraTags)
|
|
145
|
-
if (hook !== undefined) {
|
|
146
|
-
return hook
|
|
147
|
-
}
|
|
148
|
-
hook = globalMetricRegistry.get(metricKey.taggedWithLabels(key, extraTags))
|
|
149
|
-
hookCache.set(extraTags, hook)
|
|
150
|
-
return hook
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return make(
|
|
154
|
-
key.keyType,
|
|
155
|
-
(input, extraTags) => hook(extraTags).update(input),
|
|
156
|
-
(extraTags) => hook(extraTags).get(),
|
|
157
|
-
(input, extraTags) => hook(extraTags).modify(input)
|
|
158
|
-
)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/** @internal */
|
|
162
|
-
export const gauge: {
|
|
163
|
-
(name: string, options?: {
|
|
164
|
-
readonly description?: string | undefined
|
|
165
|
-
readonly bigint?: false | undefined
|
|
166
|
-
}): Metric.Metric.Gauge<number>
|
|
167
|
-
(name: string, options: {
|
|
168
|
-
readonly description?: string | undefined
|
|
169
|
-
readonly bigint: true
|
|
170
|
-
}): Metric.Metric.Gauge<bigint>
|
|
171
|
-
} = (name, options) => fromMetricKey(metricKey.gauge(name, options as any)) as any
|
|
172
|
-
|
|
173
|
-
/** @internal */
|
|
174
|
-
export const histogram = (name: string, boundaries: MetricBoundaries.MetricBoundaries, description?: string) =>
|
|
175
|
-
fromMetricKey(metricKey.histogram(name, boundaries, description))
|
|
176
|
-
|
|
177
|
-
/* @internal */
|
|
178
|
-
export const increment = (
|
|
179
|
-
self:
|
|
180
|
-
| Metric.Metric.Counter<number>
|
|
181
|
-
| Metric.Metric.Counter<bigint>
|
|
182
|
-
| Metric.Metric.Gauge<number>
|
|
183
|
-
| Metric.Metric.Gauge<bigint>
|
|
184
|
-
): Effect.Effect<void> =>
|
|
185
|
-
metricKeyType.isCounterKey(self.keyType)
|
|
186
|
-
? update(self as Metric.Metric.Counter<number>, self.keyType.bigint ? BigInt(1) as any : 1)
|
|
187
|
-
: modify(self as Metric.Metric.Gauge<number>, self.keyType.bigint ? BigInt(1) as any : 1)
|
|
188
|
-
|
|
189
|
-
/* @internal */
|
|
190
|
-
export const incrementBy = dual<
|
|
191
|
-
{
|
|
192
|
-
(amount: number): (self: Metric.Metric.Counter<number> | Metric.Metric.Counter<number>) => Effect.Effect<void>
|
|
193
|
-
(amount: bigint): (self: Metric.Metric.Counter<bigint> | Metric.Metric.Gauge<bigint>) => Effect.Effect<void>
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
(self: Metric.Metric.Counter<number> | Metric.Metric.Gauge<number>, amount: number): Effect.Effect<void>
|
|
197
|
-
(self: Metric.Metric.Counter<bigint> | Metric.Metric.Gauge<bigint>, amount: bigint): Effect.Effect<void>
|
|
198
|
-
}
|
|
199
|
-
>(2, (self, amount) =>
|
|
200
|
-
metricKeyType.isCounterKey(self.keyType)
|
|
201
|
-
? update(self as any, amount)
|
|
202
|
-
: modify(self as any, amount))
|
|
203
|
-
|
|
204
|
-
/** @internal */
|
|
205
|
-
export const map = dual<
|
|
206
|
-
<Out, Out2>(f: (out: Out) => Out2) => <Type, In>(self: Metric.Metric<Type, In, Out>) => Metric.Metric<Type, In, Out2>,
|
|
207
|
-
<Type, In, Out, Out2>(self: Metric.Metric<Type, In, Out>, f: (out: Out) => Out2) => Metric.Metric<Type, In, Out2>
|
|
208
|
-
>(2, (self, f) =>
|
|
209
|
-
make(
|
|
210
|
-
self.keyType,
|
|
211
|
-
self.unsafeUpdate,
|
|
212
|
-
(extraTags) => f(self.unsafeValue(extraTags)),
|
|
213
|
-
self.unsafeModify
|
|
214
|
-
))
|
|
215
|
-
|
|
216
|
-
/** @internal */
|
|
217
|
-
export const mapType = dual<
|
|
218
|
-
<Type, Type2>(
|
|
219
|
-
f: (type: Type) => Type2
|
|
220
|
-
) => <In, Out>(
|
|
221
|
-
self: Metric.Metric<Type, In, Out>
|
|
222
|
-
) => Metric.Metric<Type2, In, Out>,
|
|
223
|
-
<Type, In, Out, Type2>(
|
|
224
|
-
self: Metric.Metric<Type, In, Out>,
|
|
225
|
-
f: (type: Type) => Type2
|
|
226
|
-
) => Metric.Metric<Type2, In, Out>
|
|
227
|
-
>(2, (self, f) =>
|
|
228
|
-
make(
|
|
229
|
-
f(self.keyType),
|
|
230
|
-
self.unsafeUpdate,
|
|
231
|
-
self.unsafeValue,
|
|
232
|
-
self.unsafeModify
|
|
233
|
-
))
|
|
234
|
-
|
|
235
|
-
/** @internal */
|
|
236
|
-
export const modify = dual<
|
|
237
|
-
<In>(input: In) => <Type, Out>(self: Metric.Metric<Type, In, Out>) => Effect.Effect<void>,
|
|
238
|
-
<Type, In, Out>(self: Metric.Metric<Type, In, Out>, input: In) => Effect.Effect<void>
|
|
239
|
-
>(2, (self, input) =>
|
|
240
|
-
core.fiberRefGetWith(
|
|
241
|
-
core.currentMetricLabels,
|
|
242
|
-
(tags) => core.sync(() => self.unsafeModify(input, tags))
|
|
243
|
-
))
|
|
244
|
-
|
|
245
|
-
/* @internal */
|
|
246
|
-
export const set = dual<
|
|
247
|
-
{
|
|
248
|
-
(value: number): (self: Metric.Metric.Gauge<number>) => Effect.Effect<void>
|
|
249
|
-
(value: bigint): (self: Metric.Metric.Gauge<bigint>) => Effect.Effect<void>
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
(self: Metric.Metric.Gauge<number>, value: number): Effect.Effect<void>
|
|
253
|
-
(self: Metric.Metric.Gauge<bigint>, value: bigint): Effect.Effect<void>
|
|
254
|
-
}
|
|
255
|
-
>(2, (self, value) => update(self as any, value))
|
|
256
|
-
|
|
257
|
-
/** @internal */
|
|
258
|
-
export const succeed = <Out>(out: Out): Metric.Metric<void, unknown, Out> =>
|
|
259
|
-
make(void 0 as void, constVoid, () => out, constVoid)
|
|
260
|
-
|
|
261
|
-
/** @internal */
|
|
262
|
-
export const sync = <Out>(evaluate: LazyArg<Out>): Metric.Metric<void, unknown, Out> =>
|
|
263
|
-
make(void 0 as void, constVoid, evaluate, constVoid)
|
|
264
|
-
|
|
265
|
-
/** @internal */
|
|
266
|
-
export const summary = (
|
|
267
|
-
options: {
|
|
268
|
-
readonly name: string
|
|
269
|
-
readonly maxAge: Duration.DurationInput
|
|
270
|
-
readonly maxSize: number
|
|
271
|
-
readonly error: number
|
|
272
|
-
readonly quantiles: ReadonlyArray<number>
|
|
273
|
-
readonly description?: string | undefined
|
|
274
|
-
}
|
|
275
|
-
): Metric.Metric.Summary<number> => withNow(summaryTimestamp(options))
|
|
276
|
-
|
|
277
|
-
/** @internal */
|
|
278
|
-
export const summaryTimestamp = (
|
|
279
|
-
options: {
|
|
280
|
-
readonly name: string
|
|
281
|
-
readonly maxAge: Duration.DurationInput
|
|
282
|
-
readonly maxSize: number
|
|
283
|
-
readonly error: number
|
|
284
|
-
readonly quantiles: ReadonlyArray<number>
|
|
285
|
-
readonly description?: string | undefined
|
|
286
|
-
}
|
|
287
|
-
): Metric.Metric.Summary<readonly [value: number, timestamp: number]> => fromMetricKey(metricKey.summary(options))
|
|
288
|
-
|
|
289
|
-
/** @internal */
|
|
290
|
-
export const tagged = dual<
|
|
291
|
-
<Type, In, Out>(key: string, value: string) => (self: Metric.Metric<Type, In, Out>) => Metric.Metric<Type, In, Out>,
|
|
292
|
-
<Type, In, Out>(self: Metric.Metric<Type, In, Out>, key: string, value: string) => Metric.Metric<Type, In, Out>
|
|
293
|
-
>(3, (self, key, value) => taggedWithLabels(self, [metricLabel.make(key, value)]))
|
|
294
|
-
|
|
295
|
-
/** @internal */
|
|
296
|
-
export const taggedWithLabelsInput = dual<
|
|
297
|
-
<In>(
|
|
298
|
-
f: (input: In) => Iterable<MetricLabel.MetricLabel>
|
|
299
|
-
) => <Type, Out>(self: Metric.Metric<Type, In, Out>) => Metric.Metric<Type, In, void>,
|
|
300
|
-
<Type, In, Out>(
|
|
301
|
-
self: Metric.Metric<Type, In, Out>,
|
|
302
|
-
f: (input: In) => Iterable<MetricLabel.MetricLabel>
|
|
303
|
-
) => Metric.Metric<Type, In, void>
|
|
304
|
-
>(2, (self, f) =>
|
|
305
|
-
map(
|
|
306
|
-
make(
|
|
307
|
-
self.keyType,
|
|
308
|
-
(input, extraTags) =>
|
|
309
|
-
self.unsafeUpdate(
|
|
310
|
-
input,
|
|
311
|
-
Arr.union(f(input), extraTags)
|
|
312
|
-
),
|
|
313
|
-
self.unsafeValue,
|
|
314
|
-
(input, extraTags) =>
|
|
315
|
-
self.unsafeModify(
|
|
316
|
-
input,
|
|
317
|
-
Arr.union(f(input), extraTags)
|
|
318
|
-
)
|
|
319
|
-
),
|
|
320
|
-
constVoid
|
|
321
|
-
))
|
|
322
|
-
|
|
323
|
-
/** @internal */
|
|
324
|
-
export const taggedWithLabels = dual<
|
|
325
|
-
<Type, In, Out>(
|
|
326
|
-
extraTags: Iterable<MetricLabel.MetricLabel>
|
|
327
|
-
) => (self: Metric.Metric<Type, In, Out>) => Metric.Metric<Type, In, Out>,
|
|
328
|
-
<Type, In, Out>(
|
|
329
|
-
self: Metric.Metric<Type, In, Out>,
|
|
330
|
-
extraTags: Iterable<MetricLabel.MetricLabel>
|
|
331
|
-
) => Metric.Metric<Type, In, Out>
|
|
332
|
-
>(2, (self, extraTags) => {
|
|
333
|
-
return make(
|
|
334
|
-
self.keyType,
|
|
335
|
-
(input, extraTags1) => self.unsafeUpdate(input, Arr.union(extraTags, extraTags1)),
|
|
336
|
-
(extraTags1) => self.unsafeValue(Arr.union(extraTags, extraTags1)),
|
|
337
|
-
(input, extraTags1) => self.unsafeModify(input, Arr.union(extraTags, extraTags1))
|
|
338
|
-
)
|
|
339
|
-
})
|
|
340
|
-
|
|
341
|
-
/** @internal */
|
|
342
|
-
export const timer = (name: string, description?: string): Metric.Metric<
|
|
343
|
-
MetricKeyType.MetricKeyType.Histogram,
|
|
344
|
-
Duration.Duration,
|
|
345
|
-
MetricState.MetricState.Histogram
|
|
346
|
-
> => {
|
|
347
|
-
const boundaries = metricBoundaries.exponential({
|
|
348
|
-
start: 0.5,
|
|
349
|
-
factor: 2,
|
|
350
|
-
count: 35
|
|
351
|
-
})
|
|
352
|
-
const base = pipe(histogram(name, boundaries, description), tagged("time_unit", "milliseconds"))
|
|
353
|
-
return mapInput(base, Duration.toMillis)
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/** @internal */
|
|
357
|
-
export const timerWithBoundaries = (
|
|
358
|
-
name: string,
|
|
359
|
-
boundaries: ReadonlyArray<number>,
|
|
360
|
-
description?: string
|
|
361
|
-
): Metric.Metric<
|
|
362
|
-
MetricKeyType.MetricKeyType.Histogram,
|
|
363
|
-
Duration.Duration,
|
|
364
|
-
MetricState.MetricState.Histogram
|
|
365
|
-
> => {
|
|
366
|
-
const base = pipe(
|
|
367
|
-
histogram(name, metricBoundaries.fromIterable(boundaries), description),
|
|
368
|
-
tagged("time_unit", "milliseconds")
|
|
369
|
-
)
|
|
370
|
-
return mapInput(base, Duration.toMillis)
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/* @internal */
|
|
374
|
-
export const trackAll = dual<
|
|
375
|
-
<In>(
|
|
376
|
-
input: In
|
|
377
|
-
) => <Type, Out>(
|
|
378
|
-
self: Metric.Metric<Type, In, Out>
|
|
379
|
-
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
380
|
-
<Type, In, Out>(
|
|
381
|
-
self: Metric.Metric<Type, In, Out>,
|
|
382
|
-
input: In
|
|
383
|
-
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
384
|
-
>(2, (self, input) => (effect) =>
|
|
385
|
-
core.matchCauseEffect(effect, {
|
|
386
|
-
onFailure: (cause) => core.zipRight(update(self, input), core.failCause(cause)),
|
|
387
|
-
onSuccess: (value) => core.zipRight(update(self, input), core.succeed(value))
|
|
388
|
-
}))
|
|
389
|
-
|
|
390
|
-
/* @internal */
|
|
391
|
-
export const trackDefect = dual<
|
|
392
|
-
<Type, Out>(
|
|
393
|
-
metric: Metric.Metric<Type, unknown, Out>
|
|
394
|
-
) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
395
|
-
<A, E, R, Type, Out>(
|
|
396
|
-
self: Effect.Effect<A, E, R>,
|
|
397
|
-
metric: Metric.Metric<Type, unknown, Out>
|
|
398
|
-
) => Effect.Effect<A, E, R>
|
|
399
|
-
>(2, (self, metric) => trackDefectWith(self, metric, identity))
|
|
400
|
-
|
|
401
|
-
/* @internal */
|
|
402
|
-
export const trackDefectWith = dual<
|
|
403
|
-
<Type, In, Out>(
|
|
404
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
405
|
-
f: (defect: unknown) => In
|
|
406
|
-
) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
407
|
-
<A, E, R, Type, In, Out>(
|
|
408
|
-
self: Effect.Effect<A, E, R>,
|
|
409
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
410
|
-
f: (defect: unknown) => In
|
|
411
|
-
) => Effect.Effect<A, E, R>
|
|
412
|
-
>(3, (self, metric, f) => {
|
|
413
|
-
const updater = (defect: unknown) => update(metric, f(defect))
|
|
414
|
-
return effect_.tapDefect(self, (cause) => core.forEachSequentialDiscard(Cause.defects(cause), updater))
|
|
415
|
-
})
|
|
416
|
-
|
|
417
|
-
/* @internal */
|
|
418
|
-
export const trackDuration = dual<
|
|
419
|
-
<Type, Out>(
|
|
420
|
-
metric: Metric.Metric<Type, Duration.Duration, Out>
|
|
421
|
-
) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
422
|
-
<A, E, R, Type, Out>(
|
|
423
|
-
self: Effect.Effect<A, E, R>,
|
|
424
|
-
metric: Metric.Metric<Type, Duration.Duration, Out>
|
|
425
|
-
) => Effect.Effect<A, E, R>
|
|
426
|
-
>(2, (self, metric) => trackDurationWith(self, metric, identity))
|
|
427
|
-
|
|
428
|
-
/* @internal */
|
|
429
|
-
export const trackDurationWith = dual<
|
|
430
|
-
<Type, In, Out>(
|
|
431
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
432
|
-
f: (duration: Duration.Duration) => In
|
|
433
|
-
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
434
|
-
<A, E, R, Type, In, Out>(
|
|
435
|
-
self: Effect.Effect<A, E, R>,
|
|
436
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
437
|
-
f: (duration: Duration.Duration) => In
|
|
438
|
-
) => Effect.Effect<A, E, R>
|
|
439
|
-
>(3, (self, metric, f) =>
|
|
440
|
-
Clock.clockWith((clock) => {
|
|
441
|
-
const startTime = clock.unsafeCurrentTimeNanos()
|
|
442
|
-
return core.tap(self, (_) => {
|
|
443
|
-
const endTime = clock.unsafeCurrentTimeNanos()
|
|
444
|
-
const duration = Duration.nanos(endTime - startTime)
|
|
445
|
-
return update(metric, f(duration))
|
|
446
|
-
})
|
|
447
|
-
}))
|
|
448
|
-
|
|
449
|
-
/* @internal */
|
|
450
|
-
export const trackError = dual<
|
|
451
|
-
<Type, In, Out>(
|
|
452
|
-
metric: Metric.Metric<Type, In, Out>
|
|
453
|
-
) => <A, E extends In, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
454
|
-
<A, E extends In, R, Type, In, Out>(
|
|
455
|
-
self: Effect.Effect<A, E, R>,
|
|
456
|
-
metric: Metric.Metric<Type, In, Out>
|
|
457
|
-
) => Effect.Effect<A, E, R>
|
|
458
|
-
>(2, <A, E extends In, R, Type, In, Out>(
|
|
459
|
-
self: Effect.Effect<A, E, R>,
|
|
460
|
-
metric: Metric.Metric<Type, In, Out>
|
|
461
|
-
) => trackErrorWith(self, metric, (a: In) => a))
|
|
462
|
-
|
|
463
|
-
/* @internal */
|
|
464
|
-
export const trackErrorWith = dual<
|
|
465
|
-
<Type, In, Out, In2>(
|
|
466
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
467
|
-
f: (error: In2) => In
|
|
468
|
-
) => <A, E extends In2, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
469
|
-
<A, E extends In2, R, Type, In, Out, In2>(
|
|
470
|
-
self: Effect.Effect<A, E, R>,
|
|
471
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
472
|
-
f: (error: In2) => In
|
|
473
|
-
) => Effect.Effect<A, E, R>
|
|
474
|
-
>(3, <A, E extends In2, R, Type, In, Out, In2>(
|
|
475
|
-
self: Effect.Effect<A, E, R>,
|
|
476
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
477
|
-
f: (error: In2) => In
|
|
478
|
-
) => {
|
|
479
|
-
const updater = (error: E): Effect.Effect<void> => update(metric, f(error))
|
|
480
|
-
return effect_.tapError(self, updater)
|
|
481
|
-
})
|
|
482
|
-
|
|
483
|
-
/* @internal */
|
|
484
|
-
export const trackSuccess = dual<
|
|
485
|
-
<Type, In, Out>(
|
|
486
|
-
metric: Metric.Metric<Type, In, Out>
|
|
487
|
-
) => <A extends In, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
488
|
-
<A extends In, E, R, Type, In, Out>(
|
|
489
|
-
self: Effect.Effect<A, E, R>,
|
|
490
|
-
metric: Metric.Metric<Type, In, Out>
|
|
491
|
-
) => Effect.Effect<A, E, R>
|
|
492
|
-
>(2, <A extends In, E, R, Type, In, Out>(
|
|
493
|
-
self: Effect.Effect<A, E, R>,
|
|
494
|
-
metric: Metric.Metric<Type, In, Out>
|
|
495
|
-
) => trackSuccessWith(self, metric, (a: In) => a))
|
|
496
|
-
|
|
497
|
-
/* @internal */
|
|
498
|
-
export const trackSuccessWith = dual<
|
|
499
|
-
<Type, In, Out, In2>(
|
|
500
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
501
|
-
f: (value: In2) => In
|
|
502
|
-
) => <A extends In2, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
503
|
-
<A extends In2, E, R, Type, In, Out, In2>(
|
|
504
|
-
self: Effect.Effect<A, E, R>,
|
|
505
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
506
|
-
f: (value: In2) => In
|
|
507
|
-
) => Effect.Effect<A, E, R>
|
|
508
|
-
>(3, <A extends In2, E, R, Type, In, Out, In2>(
|
|
509
|
-
self: Effect.Effect<A, E, R>,
|
|
510
|
-
metric: Metric.Metric<Type, In, Out>,
|
|
511
|
-
f: (value: In2) => In
|
|
512
|
-
) => {
|
|
513
|
-
const updater = (value: A): Effect.Effect<void> => update(metric, f(value))
|
|
514
|
-
return core.tap(self, updater)
|
|
515
|
-
})
|
|
516
|
-
|
|
517
|
-
/* @internal */
|
|
518
|
-
export const update = dual<
|
|
519
|
-
<In>(input: In) => <Type, Out>(self: Metric.Metric<Type, In, Out>) => Effect.Effect<void>,
|
|
520
|
-
<Type, In, Out>(self: Metric.Metric<Type, In, Out>, input: In) => Effect.Effect<void>
|
|
521
|
-
>(2, (self, input) =>
|
|
522
|
-
core.fiberRefGetWith(
|
|
523
|
-
core.currentMetricLabels,
|
|
524
|
-
(tags) => core.sync(() => self.unsafeUpdate(input, tags))
|
|
525
|
-
))
|
|
526
|
-
|
|
527
|
-
/* @internal */
|
|
528
|
-
export const value = <Type, In, Out>(
|
|
529
|
-
self: Metric.Metric<Type, In, Out>
|
|
530
|
-
): Effect.Effect<Out> =>
|
|
531
|
-
core.fiberRefGetWith(
|
|
532
|
-
core.currentMetricLabels,
|
|
533
|
-
(tags) => core.sync(() => self.unsafeValue(tags))
|
|
534
|
-
)
|
|
535
|
-
|
|
536
|
-
/** @internal */
|
|
537
|
-
export const withNow = <Type, In, Out>(
|
|
538
|
-
self: Metric.Metric<Type, readonly [In, number], Out>
|
|
539
|
-
): Metric.Metric<Type, In, Out> => mapInput(self, (input: In) => [input, Date.now()] as const)
|
|
540
|
-
|
|
541
|
-
/** @internal */
|
|
542
|
-
export const zip = dual<
|
|
543
|
-
<Type2, In2, Out2>(
|
|
544
|
-
that: Metric.Metric<Type2, In2, Out2>
|
|
545
|
-
) => <Type, In, Out>(
|
|
546
|
-
self: Metric.Metric<Type, In, Out>
|
|
547
|
-
) => Metric.Metric<readonly [Type, Type2], readonly [In, In2], [Out, Out2]>,
|
|
548
|
-
<Type, In, Out, Type2, In2, Out2>(
|
|
549
|
-
self: Metric.Metric<Type, In, Out>,
|
|
550
|
-
that: Metric.Metric<Type2, In2, Out2>
|
|
551
|
-
) => Metric.Metric<readonly [Type, Type2], readonly [In, In2], [Out, Out2]>
|
|
552
|
-
>(
|
|
553
|
-
2,
|
|
554
|
-
<Type, In, Out, Type2, In2, Out2>(self: Metric.Metric<Type, In, Out>, that: Metric.Metric<Type2, In2, Out2>) =>
|
|
555
|
-
make(
|
|
556
|
-
[self.keyType, that.keyType] as const,
|
|
557
|
-
(input: readonly [In, In2], extraTags) => {
|
|
558
|
-
const [l, r] = input
|
|
559
|
-
self.unsafeUpdate(l, extraTags)
|
|
560
|
-
that.unsafeUpdate(r, extraTags)
|
|
561
|
-
},
|
|
562
|
-
(extraTags) => [self.unsafeValue(extraTags), that.unsafeValue(extraTags)],
|
|
563
|
-
(input: readonly [In, In2], extraTags) => {
|
|
564
|
-
const [l, r] = input
|
|
565
|
-
self.unsafeModify(l, extraTags)
|
|
566
|
-
that.unsafeModify(r, extraTags)
|
|
567
|
-
}
|
|
568
|
-
)
|
|
569
|
-
)
|
|
570
|
-
|
|
571
|
-
/** @internal */
|
|
572
|
-
export const unsafeSnapshot = (): Array<MetricPair.MetricPair.Untyped> => globalMetricRegistry.snapshot()
|
|
573
|
-
|
|
574
|
-
/** @internal */
|
|
575
|
-
export const snapshot: Effect.Effect<Array<MetricPair.MetricPair.Untyped>> = core.sync(
|
|
576
|
-
unsafeSnapshot
|
|
577
|
-
)
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
export const OP_DIE = "Die" as const
|
|
3
|
-
|
|
4
|
-
/** @internal */
|
|
5
|
-
export type OP_DIE = typeof OP_DIE
|
|
6
|
-
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const OP_EMPTY = "Empty" as const
|
|
9
|
-
|
|
10
|
-
/** @internal */
|
|
11
|
-
export type OP_EMPTY = typeof OP_EMPTY
|
|
12
|
-
|
|
13
|
-
/** @internal */
|
|
14
|
-
export const OP_FAIL = "Fail" as const
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
export type OP_FAIL = typeof OP_FAIL
|
|
18
|
-
|
|
19
|
-
/** @internal */
|
|
20
|
-
export const OP_INTERRUPT = "Interrupt" as const
|
|
21
|
-
|
|
22
|
-
/** @internal */
|
|
23
|
-
export type OP_INTERRUPT = typeof OP_INTERRUPT
|
|
24
|
-
|
|
25
|
-
/** @internal */
|
|
26
|
-
export const OP_PARALLEL = "Parallel" as const
|
|
27
|
-
|
|
28
|
-
/** @internal */
|
|
29
|
-
export type OP_PARALLEL = typeof OP_PARALLEL
|
|
30
|
-
|
|
31
|
-
/** @internal */
|
|
32
|
-
export const OP_SEQUENTIAL = "Sequential" as const
|
|
33
|
-
|
|
34
|
-
/** @internal */
|
|
35
|
-
export type OP_SEQUENTIAL = typeof OP_SEQUENTIAL
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
export const OP_BRACKET_OUT = "BracketOut" as const
|
|
3
|
-
|
|
4
|
-
/** @internal */
|
|
5
|
-
export type OP_BRACKET_OUT = typeof OP_BRACKET_OUT
|
|
6
|
-
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const OP_BRIDGE = "Bridge" as const
|
|
9
|
-
|
|
10
|
-
/** @internal */
|
|
11
|
-
export type OP_BRIDGE = typeof OP_BRIDGE
|
|
12
|
-
|
|
13
|
-
/** @internal */
|
|
14
|
-
export const OP_CONCAT_ALL = "ConcatAll" as const
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
export type OP_CONCAT_ALL = typeof OP_CONCAT_ALL
|
|
18
|
-
|
|
19
|
-
/** @internal */
|
|
20
|
-
export const OP_EMIT = "Emit" as const
|
|
21
|
-
|
|
22
|
-
/** @internal */
|
|
23
|
-
export type OP_EMIT = typeof OP_EMIT
|
|
24
|
-
|
|
25
|
-
/** @internal */
|
|
26
|
-
export const OP_ENSURING = "Ensuring" as const
|
|
27
|
-
|
|
28
|
-
/** @internal */
|
|
29
|
-
export type OP_ENSURING = typeof OP_ENSURING
|
|
30
|
-
|
|
31
|
-
/** @internal */
|
|
32
|
-
export const OP_FAIL = "Fail" as const
|
|
33
|
-
|
|
34
|
-
/** @internal */
|
|
35
|
-
export type OP_FAIL = typeof OP_FAIL
|
|
36
|
-
|
|
37
|
-
/** @internal */
|
|
38
|
-
export const OP_FOLD = "Fold" as const
|
|
39
|
-
|
|
40
|
-
/** @internal */
|
|
41
|
-
export type OP_FOLD = typeof OP_FOLD
|
|
42
|
-
|
|
43
|
-
/** @internal */
|
|
44
|
-
export const OP_FROM_EFFECT = "FromEffect" as const
|
|
45
|
-
|
|
46
|
-
/** @internal */
|
|
47
|
-
export type OP_FROM_EFFECT = typeof OP_FROM_EFFECT
|
|
48
|
-
|
|
49
|
-
/** @internal */
|
|
50
|
-
export const OP_PIPE_TO = "PipeTo" as const
|
|
51
|
-
|
|
52
|
-
/** @internal */
|
|
53
|
-
export type OP_PIPE_TO = typeof OP_PIPE_TO
|
|
54
|
-
|
|
55
|
-
/** @internal */
|
|
56
|
-
export const OP_PROVIDE = "Provide" as const
|
|
57
|
-
|
|
58
|
-
/** @internal */
|
|
59
|
-
export type OP_PROVIDE = typeof OP_PROVIDE
|
|
60
|
-
|
|
61
|
-
/** @internal */
|
|
62
|
-
export const OP_READ = "Read" as const
|
|
63
|
-
|
|
64
|
-
/** @internal */
|
|
65
|
-
export type OP_READ = typeof OP_READ
|
|
66
|
-
|
|
67
|
-
/** @internal */
|
|
68
|
-
export const OP_SUCCEED = "Succeed" as const
|
|
69
|
-
|
|
70
|
-
/** @internal */
|
|
71
|
-
export type OP_SUCCEED = typeof OP_SUCCEED
|
|
72
|
-
|
|
73
|
-
/** @internal */
|
|
74
|
-
export const OP_SUCCEED_NOW = "SucceedNow" as const
|
|
75
|
-
|
|
76
|
-
/** @internal */
|
|
77
|
-
export type OP_SUCCEED_NOW = typeof OP_SUCCEED_NOW
|
|
78
|
-
|
|
79
|
-
/** @internal */
|
|
80
|
-
export const OP_SUSPEND = "Suspend" as const
|
|
81
|
-
|
|
82
|
-
/** @internal */
|
|
83
|
-
export type OP_SUSPEND = typeof OP_SUSPEND
|