exceptionless / Exceptionless.Java

Exceptionless Java client
Apache License 2.0
6 stars 2 forks source link

Why can't I get the data for @ request #81

Open nbgesion opened 3 months ago

nbgesion commented 3 months ago

Why can't I get the data for @request? RequestInfo is Null That's how I use it. client.submitException(e);

github-actions[bot] commented 3 months ago

Thanks for reporting this issue. We will get back to you in a while

niemyjski commented 3 months ago

I'm not sure if a plugin is registered or if it's possible to get access to the request context so that is why it may not be populated. It would probably help to say what frameworks you are using and also dig into the library and take a look. I'm not familiar as this is a community maintained integration.

nbgesion commented 3 months ago

I'm not sure if a plugin is registered or if it's possible to get access to the request context so that is why it may not be populated. It would probably help to say what frameworks you are using and also dig into the library and take a look. I'm not familiar as this is a community maintained integration.

I Create a New Project. java11 and pom.xml: `

com.exceptionless exceptionless-client 0.1.0
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- EXPLICIT DECLARATION -->
<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>4.9.1</version>
</dependency>

`

Debug: WX20240530-090950@2x

I Can't Get the RequestInfo. Please.

niemyjski commented 3 months ago

@pc9795 Any ideas?

pc9795 commented 3 months ago

Let me have a look

nbgesion commented 3 months ago

Let me have a look

what's up?bro.

nbgesion commented 3 months ago

@pc9795 please look at this. WX20240530-090950@2x

pc9795 commented 2 months ago

Hello @nbgesion and thanks for your patience. I was out of the town for a while 🙇

I looked into the issue and I can see you are using

client.submitException(e)

This particular method just submits an error event with an exception and don't know anything about what request has caused this exception. We can see the code here

To get what you want to do we have to do something like this

 client.submitEventWithContext(
        EventPluginContext.builder()
            .event(client.createError().build())
            .context(PluginContext.builder().exception(e).request(request).build())
            .build());

Let me know if it solves your issue