Skip to content

Commit dd301cd

Browse files
committed
PR-suggested fixes
1 parent 9f9b811 commit dd301cd

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

temporalio/bridge/src/metric.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ fn convert_metric_event<'p>(
257257
},
258258
},
259259
)
260-
.unwrap(),
260+
.expect("Unable to create buffered metric"),
261261
);
262262
populate_into.set(Arc::new(buffered_ref)).unwrap();
263263
None
@@ -275,11 +275,11 @@ fn convert_metric_event<'p>(
275275
.clone()
276276
.as_any()
277277
.downcast::<BufferedMetricAttributes>()
278-
.unwrap()
278+
.expect("Unable to downcast to expected buffered metric attributes")
279279
.0
280280
.as_ref(py)
281281
.copy()
282-
.unwrap()
282+
.expect("Failed to copy metric attribute dictionary")
283283
.into(),
284284
None => PyDict::new(py).into(),
285285
};
@@ -292,12 +292,12 @@ fn convert_metric_event<'p>(
292292
metrics::MetricValue::Float(v) => new_attrs.set_item(kv.key, v),
293293
metrics::MetricValue::Bool(v) => new_attrs.set_item(kv.key, v),
294294
}
295-
.unwrap();
295+
.expect("Unable to set metric key/value on dictionary");
296296
}
297297
// Put on lazy ref
298298
populate_into
299299
.set(Arc::new(BufferedMetricAttributes(new_attrs_ref)))
300-
.unwrap();
300+
.expect("Unable to set buffered metric attributes on reference");
301301
None
302302
}
303303
// Convert to Python metric event
@@ -316,7 +316,7 @@ fn convert_metric_event<'p>(
316316
.clone()
317317
.as_any()
318318
.downcast::<BufferedMetricAttributes>()
319-
.unwrap()
319+
.expect("Unable to downcast to expected buffered metric attributes")
320320
.0
321321
.clone(),
322322
}),

temporalio/bridge/src/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl RuntimeRef {
134134
self.runtime
135135
.metrics_call_buffer
136136
.as_ref()
137-
.unwrap()
137+
.expect("Attempting to retrieve buffered metrics without buffer")
138138
.retrieve(),
139139
)
140140
}

temporalio/runtime.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ def __init__(self, buffer_size: int) -> None:
197197
and is drained regularly. See :py:class:`MetricBuffer` warning.
198198
199199
Args:
200-
buffer_size: Size of the buffer. Set this to a large value.
200+
buffer_size: Size of the buffer. Set this to a large value. A value
201+
in the tens of thousands or higher is plenty reasonable.
201202
"""
202203
self._buffer_size = buffer_size
203204
self._runtime: Optional[Runtime] = None

0 commit comments

Comments
 (0)