otel4s icon indicating copy to clipboard operation
otel4s copied to clipboard

Rename `SpanRef`

Open iRevive opened this issue 1 year ago • 3 comments

Sorry to be late 😅 but I do think we should bikeshed this name. As far as I understand there is nothing Ref-like here, i.e. you can't set anything. But you may read effectually, which does make it similar to RefSource.

Sorry, I don't have better naming ideas 😕

Originally posted by @armanbilge in https://github.com/typelevel/otel4s/pull/374#discussion_r1405175452

iRevive avatar Nov 27 '23 08:11 iRevive

i.e. you can't set anything

SpanRef has a Span.Backend inheritance constraint: https://github.com/typelevel/otel4s/blob/827f5f0910caf9051cb19289dea6bae29dcab2bf/sdk/trace/src/main/scala/org/typelevel/otel4s/sdk/trace/SpanRef.scala#L37

You can access all mutating operations: updateName, setStatus, etc.

iRevive avatar Nov 27 '23 09:11 iRevive

You can access all mutating operations: updateName, setStatus, etc.

Aha, I missed that.

P.S. Java SDK calls the interface ReadableSpan rather than SpanRef

So then I'm confused. Is our SpanRef like ReadableSpan or ReadWriteSpan? Because ReadableSpan doesn't appear to have mutation operations.

If we do keep SpanRef for the read-write version, then something like SpanRefSource could be okay for the read-only version, since we already have the Ref/RefSource correspondence in CE.

armanbilge avatar Nov 27 '23 12:11 armanbilge

ReadableSpan defines methods that we currently have in SpanRef: name, toSpanData, etc.

ReadWriteSpan extends ReadableSpan and Span.

iRevive avatar Nov 27 '23 12:11 iRevive