Skip to content

OTel logs should go through SdkLogger not direct to log processor - #3807

Open
itowlson wants to merge 1 commit into
spinframework:mainfrom
itowlson:dammit-otel
Open

itowlson wants to merge 1 commit into
spinframework:mainfrom
itowlson:dammit-otel

Conversation

@itowlson

Copy link
Copy Markdown
Contributor

It looks like we should not be calling the LogProcessor directly, but instead interposing a SdkLogger. This is needed because OTel packs an absolutely massive tanty if a log doesn't have an observed timestamp, and SdkLogger adds one if it's missing. (You are correct. This is indeed suboptimal.)

Draft because:

  1. I have no idea how all the OTel bits fit together so this is kind of "hit the compiler with a shoe until it lets me do the thing"
  2. I am not sure how to test it
  3. We really want to move to a more recent version of OTel anyway, which will presumably have excitingly different suboptimalities
  4. If we do use it then they'll probably want me to rename some things, you know what they're like

cc @asteurer who I think is also familiar with the OTel factor, is that right Andrew?

@asteurer

Copy link
Copy Markdown
Contributor

Yeah, I did some work on the OTel factor stuff; however, I won't be able to spare the cycles to help out with this 😞. Maybe @calebschoepp can offer some insight? He and I worked on wasi-otel together.

@calebschoepp calebschoepp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding testing I don't recall what we have in repo for tests around wasi-otel. If there is nothing then just ship it I guess.

One thing you could do is point an agent at the integration tests in https://github.com/bytecodealliance/opentelemetry-wasi and pin it to this version of Spin to confirm it still works.

Comment thread crates/factor-otel/src/host.rs Resolved
Comment thread crates/factor-otel/src/lib.rs Outdated

// OTel is mad about our Arc. Dammit OTel
#[derive(Debug)]
struct DammitOTel(Arc<BatchLogProcessor<Tokio>>);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Not quite enough condemnation for my taste

Comment thread crates/factor-otel/src/lib.rs Resolved
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
@itowlson

Copy link
Copy Markdown
Contributor Author

One thing you could do is point an agent at the integration tests in https://github.com/bytecodealliance/opentelemetry-wasi

What is "agent" in this context - do you mean in the sense of "get a LLM to do it", or in the sense of "there is an OTel thing that handles logging mechanics and you need to point that at the integration tests"

@itowlson
itowlson marked this pull request as ready for review November 30, 2026 22:37
@calebschoepp

Copy link
Copy Markdown
Contributor

What is "agent" in this context - do you mean in the sense of "get a LLM to do it", or in the sense of "there is an OTel thing that handles logging mechanics and you need to point that at the integration tests"

Agent in the sense of an LLM. It of course could be done by hand. My main point is that the most robust testing for this lives in the integration tests of that other repo.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants