Skip to content

Commit

Permalink
Add span:update_name method to Lua
Browse files Browse the repository at this point in the history
  • Loading branch information
khvzak committed Sep 6, 2024
1 parent b9b1673 commit 289f9e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion casper-server/src/lua/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ impl UserData for LuaSpan {
Ok(())
});

// Update the span name.
methods.add_method_mut("update_name", |_, this, name: String| {
this.0.update_name(name);
Ok(())
});

// Signals that the operation described by this span has now ended.
methods.add_method_mut("finish", |_, this, ()| {
this.0.end();
Expand Down Expand Up @@ -213,7 +219,8 @@ mod tests {

tracer.in_span("root", |_cx| {
lua.load(chunk! {
local span = $trace.new_span("child", "client")
local span = $trace.new_span("TBC", "client")
span:update_name("child")
span:set_attributes({ foo = 1, hello = "world" })
span:set_status("ok")
span:add_event("event", { bar = 1 })
Expand Down

0 comments on commit 289f9e8

Please sign in to comment.