You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by BenVee <bv...@vectron.de> on 2017/02/01 11:51:05 UTC

Contextual Logging with Ignite Services

Hello Ignite users,

I wonder how contextual logging could be realised with Ignite services.

Imagine service A provides a HTTP REST API and consumes service B. Now when
a HTTP request is incoming thru service A I'd like to know the ID of the
request/session that has caused a log line at service B.

Are there any known best practices achieving this with the grid logger or
Ignite services at all? Do I have to implement my own un/wrapper to forward
the context data. Unfortunately it's not possible to intercept the service
call on the transport level to inject the context afaik (like it is possible
w/ Apache Thrift). That leaves me with all service methods having to accept
a nth argument which is the context.

E.g. I have a login service which has a method LoginService::login(String
email, String password). I'd need to extend this method to
LoginService::login(String email, String password, Context context) no
matter if I need the context for logging or not. 

It would be brilliant to have something like a getContext method which
returns the context for the call that is being invoked, while one would be
able to set the context at the caller level for the next call. However I am
not certain about the right approach.

Please correct me if I am wrong and if there is a solution available that I
don't know yet. I believe this is a quite common requirement for micro
service implementations for e.g. monitoring or log analysis.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Contextual-Logging-with-Ignite-Services-tp10354.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Contextual Logging with Ignite Services

Posted by Nikolai Tikhonov <nt...@apache.org>.
Hello!

Unfortunately, Ignite does not provide this functionality out of box. Your
approach with adding "context" parameter looks ok. Also you can use simple
int (sessionId) and persist context object to cache that allows support
fault tolerance for sessions.

On Wed, Feb 1, 2017 at 2:51 PM, BenVee <bv...@vectron.de> wrote:

> Hello Ignite users,
>
> I wonder how contextual logging could be realised with Ignite services.
>
> Imagine service A provides a HTTP REST API and consumes service B. Now when
> a HTTP request is incoming thru service A I'd like to know the ID of the
> request/session that has caused a log line at service B.
>
> Are there any known best practices achieving this with the grid logger or
> Ignite services at all? Do I have to implement my own un/wrapper to forward
> the context data. Unfortunately it's not possible to intercept the service
> call on the transport level to inject the context afaik (like it is
> possible
> w/ Apache Thrift). That leaves me with all service methods having to accept
> a nth argument which is the context.
>
> E.g. I have a login service which has a method LoginService::login(String
> email, String password). I'd need to extend this method to
> LoginService::login(String email, String password, Context context) no
> matter if I need the context for logging or not.
>
> It would be brilliant to have something like a getContext method which
> returns the context for the call that is being invoked, while one would be
> able to set the context at the caller level for the next call. However I am
> not certain about the right approach.
>
> Please correct me if I am wrong and if there is a solution available that I
> don't know yet. I believe this is a quite common requirement for micro
> service implementations for e.g. monitoring or log analysis.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Contextual-Logging-with-Ignite-Services-tp10354.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>