Skip to content

Commit

Permalink
PR-suggested fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz committed Sep 28, 2023
1 parent 9f9b811 commit dd301cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions temporalio/bridge/src/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ fn convert_metric_event<'p>(
},
},
)
.unwrap(),
.expect("Unable to create buffered metric"),
);
populate_into.set(Arc::new(buffered_ref)).unwrap();
None
Expand All @@ -275,11 +275,11 @@ fn convert_metric_event<'p>(
.clone()
.as_any()
.downcast::<BufferedMetricAttributes>()
.unwrap()
.expect("Unable to downcast to expected buffered metric attributes")
.0
.as_ref(py)
.copy()
.unwrap()
.expect("Failed to copy metric attribute dictionary")
.into(),
None => PyDict::new(py).into(),
};
Expand All @@ -292,12 +292,12 @@ fn convert_metric_event<'p>(
metrics::MetricValue::Float(v) => new_attrs.set_item(kv.key, v),
metrics::MetricValue::Bool(v) => new_attrs.set_item(kv.key, v),
}
.unwrap();
.expect("Unable to set metric key/value on dictionary");
}
// Put on lazy ref
populate_into
.set(Arc::new(BufferedMetricAttributes(new_attrs_ref)))
.unwrap();
.expect("Unable to set buffered metric attributes on reference");
None
}
// Convert to Python metric event
Expand All @@ -316,7 +316,7 @@ fn convert_metric_event<'p>(
.clone()
.as_any()
.downcast::<BufferedMetricAttributes>()
.unwrap()
.expect("Unable to downcast to expected buffered metric attributes")
.0
.clone(),
}),
Expand Down
2 changes: 1 addition & 1 deletion temporalio/bridge/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl RuntimeRef {
self.runtime
.metrics_call_buffer
.as_ref()
.unwrap()
.expect("Attempting to retrieve buffered metrics without buffer")
.retrieve(),
)
}
Expand Down
3 changes: 2 additions & 1 deletion temporalio/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ def __init__(self, buffer_size: int) -> None:
and is drained regularly. See :py:class:`MetricBuffer` warning.
Args:
buffer_size: Size of the buffer. Set this to a large value.
buffer_size: Size of the buffer. Set this to a large value. A value
in the tens of thousands or higher is plenty reasonable.
"""
self._buffer_size = buffer_size
self._runtime: Optional[Runtime] = None
Expand Down

0 comments on commit dd301cd

Please sign in to comment.