Skip to content

Instantly share code, notes, and snippets.

@vhf
Created September 16, 2025 19:45
Show Gist options
  • Save vhf/0bb7b62dd6f9d0c369602eabadd89800 to your computer and use it in GitHub Desktop.
Save vhf/0bb7b62dd6f9d0c369602eabadd89800 to your computer and use it in GitHub Desktop.
defmodule SAppsignal.Span do
defstruct [
:kind,
:reason,
:stack,
:name,
:extra
]
def set_name(span, name) do
%{span | name: name}
end
def set_attribute(span, key, val) do
%{span | extra: Map.put(span.extra, key, val)}
end
def set_sample_data_if_nil(span, key, val) do
%{span | extra: Map.put_new(span.extra, key, val)}
end
end
defmodule SAppsignal do
def send_error(kind, reason, stack, fun) do
fun.(%SAppsignal.Span{
kind: kind,
reason: reason,
stack: stack,
extra: %{}
})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment