Skip to content

O11y.SpanAttributes protocol isn't called for Tuples when setting attributes #154

@ulissesalmeida

Description

@ulissesalmeida

I'm not sure here is the right repo, or O11y. But here what I tried:

@decorate trace("myapp.my_func",  include: [:result])

### somwehere else:

defimpl O11y.SpanAttributes, for: Tuple do
  def get(tuple) do
    # ... it would generate [{"status", "ok"}] for {:ok, contents} tuple,
    # ... or generate [{"status", "error"}, {"reason", "timeout"}] for {:error, :timeout} tuple
  end
end

I tested that, and it doesn't work because the O11y doesn't attempt to call O11y.SpanAttributes.get/1 for tuples, only for map or structs

In other words, I would like to give easy visibility when a function returned successfully or had an error based on the signal tuples we're using in our app. Ideally, we would like the tracer could intelligently understand it or the library user to extend the functionality to do it.

What do you think? Where is the best place for an extension like this? Or do you have a better recommendation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions