bot-detector icon indicating copy to clipboard operation
bot-detector copied to clipboard

[Statistics] Not able to retrieve for a while now

Open Nick2bad4u opened this issue 1 year ago • 2 comments

image I haven't been able to see my stats for a good while now, about a month I'd say?

Nick2bad4u avatar Aug 18 '24 02:08 Nick2bad4u

@extreme4all has been doing a lot of background changes to how plugin data is stored and presented through the server API. Not much I can do here, but he may be able to she some loght on this. As far as I am aware, your stats are still being tracked at least.

Cyborger1 avatar Aug 18 '24 05:08 Cyborger1

@Nick2bad4u i'd need your rsn to debug the problem, you may not want to put this on github for eveyone to see, but you can make a ticket on discord our discord, under the support channel https://discord.gg/DEQCzuGP

extreme4all avatar Aug 18 '24 11:08 extreme4all

@Nick2bad4u i'd need your rsn to debug the problem, you may not want to put this on github for eveyone to see, but you can make a ticket on discord our discord, under the support channel https://discord.gg/DEQCzuGP

My rsn is:

Nick2bad4u avatar Aug 18 '24 14:08 Nick2bad4u

Hey @Nick2bad4u thanks for the report, i found two bugs, and the issue should now be resolved.

  • for the migration check it could return None if the player does not exist
    • https://github.com/Bot-detector/Bot-Detector-Core-Files/commit/dba1cff9b2a2e72cf9ab2bf993ec9de585793527
  • the report-worker did not handle validation errors properly
    • https://github.com/Bot-detector/report-worker/commit/50102c4db745ff37ff45d0f09032f84c1ae74d1c

extreme4all avatar Aug 18 '24 15:08 extreme4all

Thanks.

We're you able to restore my old stats? (Can't check until tonight)

Nick2bad4u avatar Aug 18 '24 15:08 Nick2bad4u

Thanks.

We're you able to restore my old stats? (Can't check until tonight)

yes no data was lost, just an error in querying the data

extreme4all avatar Aug 18 '24 15:08 extreme4all

Thanks. We're you able to restore my old stats? (Can't check until tonight)

yes no data was lost, just an error in querying the data

image Looks fixed!

Nick2bad4u avatar Aug 18 '24 22:08 Nick2bad4u

I've recently started using this plugin, and after about a week of using it I still have no stats listed. I have anonymous mode turned off. Is this bug still happening?

Biglulux avatar Apr 30 '25 14:04 Biglulux

I've recently started using this plugin, and after about a week of using it I still have no stats listed. I have anonymous mode turned off. Is this bug still happening?

It should not be happening, I just checked and it's working fine for me, feel free to drop by the discord and open a ticket if you're having issues.

Cyborger1 avatar Apr 30 '25 15:04 Cyborger1

I've recently started using this plugin, and after about a week of using it I still have no stats listed. I have anonymous mode turned off. Is this bug still happening?

Adding to my previous reply, one thing you could try doing is ensure your PC's date and time is properly synced to a time server. The Bot Detector server tends to drop data sent to it if the player's reported system time is out of date.

In Windows, look for "Change Time and Date", make sure "Set the time automatically" is on and that the last successful sync is recent.

Image

Cyborger1 avatar Apr 30 '25 15:04 Cyborger1

I've recently started using this plugin, and after about a week of using it I still have no stats listed. I have anonymous mode turned off. Is this bug still happening?

Adding to my previous reply, one thing you could try doing is ensure your PC's date and time is properly synced to a time server. The Bot Detector server tends to drop data sent to it if the player's reported system time is out of date.

In Windows, look for "Change Time and Date", make sure "Set the time automatically" is on and that the last successful sync is recent.

Image

Want me to take a look at writing a fix for the time sync? Or is that something that needs to be done server side?

Nick2bad4u avatar Apr 30 '25 18:04 Nick2bad4u

Want me to take a look at writing a fix for the time sync? Or is that something that needs to be done server side?

If there's a change to be made, it would have to be on the server side, either by erroring out when bad data is being sent (it's currently a silent fail), or by adjusting the data sent by the user.

The server requires that the user's system time is properly synchronized, otherwise the sightings being sent have incorrect timestamps, messing up the database.

Now though, I made sure that when the data is being sent, the request header includes a copy of the user's system unix timestamp at the time of the request. On the server side, it would be possible to calculate the difference between that and the server's timestamp, then adjust the sighting timestamps by that diff.

This is something I've discussed with Extreme in the past, but he's not a fan of the idea. You may want to talk to him about this.

Another option would be to add a route to the server to pull up its timestamp to check on the plugin side if there's a discrepancy, or try to connect to some public time syncing server? It's definitely a complicated issue.

I think the simplest solution would be to go the error route, have the server error out if the request timestamp header is out of date, then we can at least have a copy of that error in the runelite logs we can point players to. (The field in the header is called Request-Epoch)

Cyborger1 avatar Apr 30 '25 18:04 Cyborger1

Want me to take a look at writing a fix for the time sync? Or is that something that needs to be done server side?

If there's a change to be made, it would have to be on the server side, either by erroring out when bad data is being sent (it's currently a silent fail), or by adjusting the data sent by the user.

The server requires that the user's system time is properly synchronized, otherwise the sightings being sent have incorrect timestamps, messing up the database.

Now though, I made sure that when the data is being sent, the request header includes a copy of the user's system unix timestamp at the time of the request. On the server side, it would be possible to calculate the difference between that and the server's timestamp, then adjust the sighting timestamps by that diff.

This is something I've discussed with Extreme in the past, but he's not a fan of the idea. You may want to talk to him about this.

Another option would be to add a route to the server to pull up its timestamp to check on the plugin side if there's a discrepancy, or try to connect to some public time syncing server? It's definitely a complicated issue.

I think the simplest solution would be to go the error route, have the server error out if the request timestamp header is out of date, then we can at least have a copy of that error in the runelite logs we can point players to. (The field in the header is called Request-Epoch)

Do you have any idea how big of a buffer it allows?

Is it like 10 seconds either way or minutes?

Nick2bad4u avatar Apr 30 '25 19:04 Nick2bad4u

I'm not sure, I believe it is located here https://github.com/Bot-detector/public-api/blob/ce3cdc53896b23a3797bc47d6735d8191abc7c18/src/app/repositories/report.py#L23

@extreme4all can confirm, it appears to only check that the sightings themselves are within -7hrs to +1hr of current time and doesn't check the request header for Request-Epoch.

Cyborger1 avatar Apr 30 '25 20:04 Cyborger1

I'm not sure, I believe it is located here https://github.com/Bot-detector/public-api/blob/ce3cdc53896b23a3797bc47d6735d8191abc7c18/src/app/repositories/report.py#L23

@extreme4all can confirm, it appears to only check that the sightings themselves are within -7hrs to +1hr of current time and doesn't check the request header for Request-Epoch.

Hmm. That seems pretty reasonable. Your clock would have to be pretty far out of sync -- and in modern days with ease of syncing time servers, I only see that being a miniscule portion of the traffic.

Nick2bad4u avatar May 03 '25 02:05 Nick2bad4u