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

Mind notes - design issues #1

Open
rogeralsing opened this issue Dec 10, 2022 · 5 comments
Open

Mind notes - design issues #1

rogeralsing opened this issue Dec 10, 2022 · 5 comments

Comments

@rogeralsing
Copy link
Contributor

This library uses a custom ActorRefProvider to allow decorating actors with middleware.
This works but is problematic in a few ways:

In Proto.Actor, messages can have headers, just like in HTTP etc.
Akka.NET does not have this. therefore I'm using an envelope type for the payload.
This means that when sending a message, we either need to know up front if the target actorref belongs to a tracable actor.
so that we don't send envelopes to non-traced actors.

Or, we just make it so that all local actors are decorated with the tracing middleware, and get around this issue that way.

Another issue is likely Akka.Remote, e.g. if a remote node does not have tracing enabled, then sending envelopes to those would fail.

Therefore, I think the naive but pragmatic way would be to enforce that all nodes in the Akka.NET system/cluster all have this extension enabled.

If someone has any other ideas, shoot

@rogeralsing
Copy link
Contributor Author

I still need to figure out how to properly replace the RemoteActorRefProvider, maybe just copy paste all code from the original class.

Another interesting thing to solve, the old async await TaskScheduler bits also needs to work.
Maybe just keeping the activity info around for as long as the async task is running.

@rogeralsing
Copy link
Contributor Author

The current actor context needs to be intercepted somehow.
e.g. Context.ActorSelection needs to be intercepted

@rogeralsing
Copy link
Contributor Author

rogeralsing commented Dec 11, 2022

Intercepting ActorSelection:

  • Inherit ActorSelection, would sort of work, unless someone casts to basetype, then Tell would be invoked on the non intercepted base type.

  • inject a custom anchor, this is probably better. then there is no need to touch actorselection itself.

        internal static void DeliverSelection(IInternalActorRef anchor, IActorRef sender, ActorSelectionMessage sel)
        {
            if (sel.Elements.IsNullOrEmpty())
            {
                anchor.Tell(sel.Message, sender);   <-- if the anchor is tracable, it should work out of the box?

@rogeralsing
Copy link
Contributor Author

If I just copy contents of ActorSelection and inject a tracable anchor. it might work?

@rogeralsing
Copy link
Contributor Author

rogeralsing commented Dec 11, 2022

Next issue. how do I know if headers should be used for e.g. remote senders?
Responses sent to the chat client from the chat server demo are not traced as the server doesn't know if it should use tracing headers or not

Maybe it could be possible to determine if headers should be used if target actorref is in user-space?
e.g.
akka.tcp://MyServer@localhost:8081/user/ChatServer

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

1 participant