-
Notifications
You must be signed in to change notification settings - Fork 13
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
Adding observability support #61
Comments
Hey thanks for writting up the detailed report of the issue and I really appreciate the assiduous work you've done on making spin more observable. fwiw, I did some investigation on adding opentelemtry and tracing to runwasi: containerd/runwasi#10, so the last point about converting all upstream projects to use |
I'd love standardizing shims on runwasi solution! Let's do make sure we ping owners of the downstream shims to let them know and get their feedback. |
Thanks for the write-up, @calebschoepp. Zooming in on one of the things you mentioned there, @calebschoepp:
Does that mean we could surface some of the shim logs (which are runtime logs, some that might be very useful when debugging apps) to the pod logs? |
Nice, I'm happy to collab on this too. Couple of thoughts and questions for you:
|
Yes, I think that is a possibility. |
@calebschoepp It looks like @Mossaka wired up the Would that be something worth trying or do you think we will still be missing some of the logs because of " It turns out Spin relies on the tracing-log feature to pick up any logs emitted from within Spin or in upstream dependencies via tracing::log::* or log::*. " |
@jsturtevant That's an interesting idea, but I don't think it is actually any different in the end. From reading the docs it appears that It sort of skirts the issue of the conflicting global loggers b/c it doesn't setup a global logger for the tracing-log compatibility layer. But, we're still left with the issue of Spin relying on this compatibility layer. I need to do more investigating on how much we rely on this compatibility layer. I still think the easy way out is to turn off the tracing-log compat layer, and that the cleanest way out is to convert all the upstream libraries to tracing. |
After some reflection and conversation with @radu-matei I've decided that the most straightforward way to land o11y support in SpinKube is by disabling the I still think we should standardize on tracing in all the libraries though fwiw. |
o11y support has landed in the shim so I'm closing this. Config work is being tracked here. |
Observability in shim
Spin 2.4 introduced basic OpenTelemetry observability support to Spin. More specifically it added support for the tracing OTEL signal. Traces are emitted when apps are triggered or host components are called.
I would like
containerd-shim-spin
to have this observability support too. We must use thespin-telemetry
crate to setup this support:Under the hood
spin_telemetry::init
is setting up a tracing subscriber to put logs out to STDERR and traces to a configured OTEL exporter.The integration doesn't work
Out of the box integrating
spin-telemetry
withcontainerd-shim-spin
panics:After lots of digging (and help from @kate-goldenring, @vdice, and @radu-matei 🙏) it was determined that the issue is that we are trying to set a global logger twice. The obvious place where it is here in the
containerd-shim
. The less obvious place where it is set is here intracing-subscriber
.It turns out that
spin-telemetry
usestracing-subscriber
which by default has atracing-log
feature turned on. Thistracing-log
feature turns on a compatability layer wheretracing
will pick up anylog
messages and print them astracing
events. Thetracing-log
feature inevitably boils down to configuring a global logger.It should also be noted that the
trigger-sqs
crate also depends ontracing-subscriber
and configures a global logger.Possible fixes
Turn off the
containerd-shim
loggerOne obvious fix is to just turn off the
containerd-shim
logger:This works, but has the obvious problem that we aren't able to get any logs. Oddly enough this approach does have some of the
containerd-wasm-shim
logs picked up by the tracing subscriber thatspin-telemetry
uses. In other words some of the shim logs are emitted as app logs.An example of this approach is found in #60.
Disable
tracing-log
feature in upstream cratesAs seen in this Spin PR and this trigger-sqs PR we can turn off the
tracing-log
feature and we don't get the panic. This seems like a good fix, but has a key issue. It turns out Spin relies on thetracing-log
feature to pick up any logs emitted from within Spin or in upstream dependencies viatracing::log::*
orlog::*
. To simplify if we turn off the feature we are going to be losing some logging from Spin that we don't want to lose.An example of this approach is found in #59.
Convert all of
containerd-shim-spin
,runwasi
, andcontainerd-shim
to usetracing
instead oflog
This is extremely far fetched, but I thought it was worth mentioning b/c it would technically solve our problem.
Another option I'm not thinking of
I'm all ears 👂
Going forward
I've been working on this for awhile and feel like I have hit an impasse. I am only trying to integrate observability into the shim, but it feels like I have tapped into a much larger issue of logging in the shim. I would appreciate input and direction from the maintainers to help drive this forward.
The text was updated successfully, but these errors were encountered: