@@ -5,7 +5,16 @@ import { Redis } from "@internal/redis";
55import * as redlock from "redlock" ;
66import { tryCatch } from "@trigger.dev/core" ;
77import { Logger } from "@trigger.dev/core/logger" ;
8- import { startSpan , Tracer , Meter , getMeter , ValueType , ObservableResult , Attributes , Histogram } from "@internal/tracing" ;
8+ import {
9+ startSpan ,
10+ Tracer ,
11+ Meter ,
12+ getMeter ,
13+ ValueType ,
14+ ObservableResult ,
15+ Attributes ,
16+ Histogram ,
17+ } from "@internal/tracing" ;
918
1019const SemanticAttributes = {
1120 LOCK_TYPE : "run_engine.lock.type" ,
@@ -41,23 +50,17 @@ export class RunLocker {
4150 this . tracer = options . tracer ;
4251 this . meter = options . meter ?? getMeter ( "run-engine" ) ;
4352
44- const activeLocksObservableGauge = this . meter . createObservableGauge (
45- "run_engine.locks.active" ,
46- {
47- description : "The number of active locks by type" ,
48- unit : "1" ,
49- valueType : ValueType . INT ,
50- }
51- ) ;
53+ const activeLocksObservableGauge = this . meter . createObservableGauge ( "run_engine.locks.active" , {
54+ description : "The number of active locks by type" ,
55+ unit : "locks" ,
56+ valueType : ValueType . INT ,
57+ } ) ;
5258
53- const lockDurationHistogram = this . meter . createHistogram (
54- "run_engine.lock.duration" ,
55- {
56- description : "The duration of lock operations" ,
57- unit : "ms" ,
58- valueType : ValueType . DOUBLE ,
59- }
60- ) ;
59+ const lockDurationHistogram = this . meter . createHistogram ( "run_engine.lock.duration" , {
60+ description : "The duration of lock operations" ,
61+ unit : "ms" ,
62+ valueType : ValueType . DOUBLE ,
63+ } ) ;
6164
6265 activeLocksObservableGauge . addCallback ( this . #updateActiveLocksCount. bind ( this ) ) ;
6366 this . lockDurationHistogram = lockDurationHistogram ;
@@ -108,10 +111,10 @@ export class RunLocker {
108111
109112 const [ error , result ] = await tryCatch (
110113 this . redlock . using ( resources , duration , async ( signal ) => {
111- const newContext : LockContext = {
112- resources : joinedResources ,
114+ const newContext : LockContext = {
115+ resources : joinedResources ,
113116 signal,
114- lockType : name
117+ lockType : name ,
115118 } ;
116119
117120 // Track active lock
0 commit comments