tom-draper / api-analytics

Lightweight monitoring and analytics for API frameworks.
https://apianalytics.dev
MIT License
179 stars 26 forks source link

No requests logged for a long time #36

Closed rust-kotlin closed 5 months ago

rust-kotlin commented 5 months ago

Hi, bro, I am using this library to monitor my axum app, I think I add this middleware layer to my main router rightly and send requests to my web app, but it seemed that it keeps finding no requests.

So does this logging has some update intervals such as every day that I can't see the recording instantly? Hoping for your reply!

rust-kotlin commented 5 months ago

I tested the res by this api, it seems that the server thinks the data sent to api-analytics is not formal with status code 400.

Response: Response { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("www.apianalytics-server.com")), port: None, path: "/api/log-request", query: None, fragment: None }, status: 400, headers: {"server": "nginx/1.18.0 (Ubuntu)", "date": "Sun, 07 Apr 2024 16:29:51 GMT", "content-type": "application/json; charset=utf-8", "content-length": "40", "connection": "keep-alive"} }

rust-kotlin commented 5 months ago

It seemed that this is due to the lack of ip, which is set to be empty String.

tom-draper commented 5 months ago

Thanks for raising this, it should be correct now. There was an integer overflow error on the server when unique user agents were being submitted. It looks unlikely to be related to an empty ip address. Are you able to confirm it's working as you expect now?

rust-kotlin commented 5 months ago

Yeah, Thanks! Actually I found that it was due to the user agent six hours ago. Because my user agent is from WeChat Mini Program, it might be somewhat special . When I give a default chrome user agent, it worked for me. I will test your modifications when I am free.

rust-kotlin commented 5 months ago

Hi, there! The dashborad loading circle keeps for minutes untill the charts display! Is this some server side error?

chalex-eth commented 4 months ago

Hey @tom-draper, Thanks for your amazing tool, I wanted to give a try, I implement the analytics on an axum project, however I do not have any data into the dashboard or the api. Is there any latency to expect ? Or did I do something wrong ? Thank you

tom-draper commented 4 months ago

It should just be a 60 second delay before they appear in the dashboard, and your API will need to have been receiving requests for at least two minutes. I'd also double check your API key is being correctly passed as a parameter. Let us know if it remains an issue and I'll look into it

chalex-eth commented 4 months ago

Thank you for responding quickly. Here is my api key and how I use it.

let app = Router::new()
        .layer(Analytics::new(String::from(
            "0545b867-45b2-44c6-9c2d-7269a0ec5e12",
        )))
....

@tom-draper I still get no request, if you can give a look, it would be awesome. Thank you

loremaps commented 3 months ago

@tom-draper thanks for this tool.

We also do not see any data on the dashboard (we are using fastify integration). No errors, just to data. Using the API https://apianalytics-server.com/api/data, we get back and empty array.

Thanks!

tom-draper commented 3 months ago

@chalex-eth It doesn't look as though your logged requests are reaching the server. Are you able to check whether there is an issue sending requests from your APIs environment?

I'll have a look at these issues as soon as possible, although I'm on holiday at the moment so I may be a few days

chalex-eth commented 3 months ago

@tom-draper Thanks for the response, any idea how to try to debug to check if requests are sent ?

tom-draper commented 3 months ago

@loremaps This issue should be fixed if you upgrade node-api-analytics to >=1.2.2, thanks

loremaps commented 3 months ago

@tom-draper thank you, it works now!