Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTelemetry span for ZStream #728

Open
senia-psm opened this issue Jul 10, 2023 · 4 comments
Open

OpenTelemetry span for ZStream #728

senia-psm opened this issue Jul 10, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@senia-psm
Copy link
Member

It is impossible to implement a proper span for a ZStream returning method.

It requires a version of Tracing::span for Zstream instead of ZIO.

@grouzen grouzen added the enhancement New feature or request label Jul 11, 2023
@grouzen
Copy link
Contributor

grouzen commented Jul 13, 2023

It may be related to #722

@grouzen
Copy link
Contributor

grouzen commented Jul 14, 2023

Tracing.spanScoped has been added recently in #709.
There is also a Discord thread with a discussion about it https://discord.com/channels/629491597070827530/639825316021272602/1113090265041862697. I mean, it could be a solution for your case, but I'm not sure exactly what issue you have. It would be nice if you added more context. Thanks!

@senia-psm
Copy link
Member Author

@grouzen thank you for the update. The feature is merged in series/2.x, but I can;t find 2.x version with this feature. Are there any plans of publishing this feature?

For me it might be not enough (but there is a workaround - see below) - I have ZStream on top level, so I need the same option, but for spanFrom (spanFromScoped?).

I believe the idea with Scope would work - we can use it in ZStream.unwrapScoped.

My use case zio-http endpoint implementation returning ZStream of bytes. It should accept W3C headers and create a span using spanFrom with parent context from headers.

Possible workaround: using ZIO[,,ZStream[...]] I can create a main span with spanFrom and then a child span with spanScoped. The parent span might get closed before the child span and we can get invalid timings, but it shoudl be good enough.

@grouzen
Copy link
Contributor

grouzen commented Jul 15, 2023

The feature is merged in series/2.x, but I can;t find 2.x version with this feature. Are there any plans of publishing this feature?

You can find it in 3.0.0-RC14 version. 2.x in the branch name means that it is based on ZIO 2.x version.

I believe the idea with Scope would work - we can use it in ZStream.unwrapScoped.

Right.

My use case zio-http endpoint implementation returning ZStream of bytes. It should accept W3C headers and create a span using spanFrom with parent context from headers.

I see. It's been a hot topic lately :) There are more threads have been going recently in Discord related to it:

All this interest from people makes me think about adding API for ZStream. It might be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants