austince edited a comment on pull request #303:
URL: https://github.com/apache/flink-statefun/pull/303#issuecomment-1050064916


   Since contexts are trees, as long as you use the current context in the 
Derive I think this would have a very similar effect. And since the 
`context.Context` in the internal `statefunContext` is not a pointer, shouldn't 
it be isolated to only the downstream consumers of where `DeriveContext` is 
called, so it wouldn't interfere with any internal usage? I guess if the 
`statefunContext` needs to use the `context.Context` in any of the implemented 
methods, that could be an issue if someone doesn't build on the current 
context, as Galen pointed out, but it doesn't seem like that is the design of 
the current implementations nor does it seem like something that couldn't 
produce a `panic` telling users not to do that.  Maybe I'm missing something.
   
   ```go
   // in the library
   tracingKey := "trace"
   traceID := "ABC"
   originalContext := StatfunContext(context.WithValue(ctx, tracingKey, 
traceId)) // fake, internally constructed initial context
   
   
   // in the Invoke method, user code
   newContext := DeriveContext(originalContext, 
context.WithValue(originalContext, "a", "b"))
   
   newContext.Value(tracingKey) == "ABC"
   
   newContext.Context != originalContext.Context
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to