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

Instrument Durable Objects #12

Open
BraunreutherA opened this issue Aug 16, 2022 · 6 comments
Open

Instrument Durable Objects #12

BraunreutherA opened this issue Aug 16, 2022 · 6 comments

Comments

@BraunreutherA
Copy link
Contributor

Hey there 👋

It would be nice if we can instrument the fetch call to durable objects.

@RichiCoder1
Copy link
Owner

Like #11, an MVP should be the SDK taking the durable object stub, and returning a wrapper with the same fetch interface that makes sure the trace is propagated. I believe the "receive" end should just work as long as it's a normal fetch handler also.

@RichiCoder1
Copy link
Owner

This may be "done" via #21, but I haven't validated.

@RichiCoder1
Copy link
Owner

This is likely resolved with 0.6.0, however I'm not sure about the recieving end so keeping this open.

@oxcafedead
Copy link

I'm afraid this won't work for Durable Objects because of slightly different syntax:

const id = env.DURABLE_OBJ.idFromName('xxx')
const stub = env.DURABLE_OBJ.get(id); // this method will fail with sdk
const response = await stub.fetch(request);

So, we canot just simply have sdk.env.DURABLE_OBJ.fetch or sdk.env.DURABLE_OBJ.get(id).fetch

@oxcafedead
Copy link

oxcafedead commented Apr 3, 2023

Maybe as an idea, it makes sense to make public methods to create spans so that Durable Object invocation can at least be manually 'wrapped':

sdk.createSpan();
durableObjects.get...fetch();
sdk.endSpan();

@RichiCoder1
Copy link
Owner

Ah darn, I thought it had the same syntax. I forgot it stubbed out. It should still be possible to proxy the stub however 🤔.

I could definitely add support for creating spans directly, though it might be a little weird due to the way the SDK currently works. #26 might help make that "just work"

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

No branches or pull requests

3 participants