input-output-hk / smash

Stakepool Metadata Aggregation Server
36 stars 7 forks source link

Smash server returns not oldest errors with "/api/v1/errors/poolid" #189

Open os11k opened 2 years ago

os11k commented 2 years ago

So there is a pool in mainnet(383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd) which had 10 errors in 16th of December and 10 errors in 21st of December.

So when I run curl -X GET https://smash.cardano-mainnet.iohk.io/api/v1/errors/383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd

I would expect to see latest errors, but in reality it just shows errors from 16th of Decemeber:

[
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 0,
        "cause": "Connection failure when fetching metadata from https://git.io/Ju4Ld'.",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 1,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 2,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 3,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 4,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 5,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 6,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 7,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 8,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    },
    {
        "utcTime": "1639657840.058877s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 9,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "c90f4989dfc0b3f99822c9ce56eb0e2487185385c1a0ad5ecf719a81e6c5394f",
        "time": "16.12.2021. 12:30:40"
    }
]

But if we will put fromDate=20.12.2021 it will show latest errors from 21st of December:

curl -X GET https://smash.cardano-mainnet.iohk.io/api/v1/errors/383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd?fromDate=20.12.2021

[
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 5,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 8,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 3,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 4,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 6,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 7,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 0,
        "cause": "Connection failure when fetching metadata from https://meta.5chpool.net/5ch.json'.",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 1,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 2,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    },
    {
        "utcTime": "1640112301.05552s",
        "poolId": "383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd",
        "retryCount": 9,
        "cause": "URL parse error from for pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg resulted in : InvalidUrlException \"pool18q7axjzcrs7pd2vpmcgh33p0r5cng2q0v6ldw5vtwuhl6ctgmeg\" \"Invalid URL\"",
        "poolHash": "8d9d155065262c372d2d6bf4ac566e3a3208df5eb4a33d0a574d644697b2623f",
        "time": "21.12.2021. 18:45:01"
    }
]

Seems like a bug for me, I would expect to receive most recent errors when I do request /api/v1/errors/poolid

5ch-pool commented 2 years ago

This all started when I consulted os11k about a problem with my pool not showing up on Daedalus.

Here's some additional information. I also know that adding a slash to the end of the URL of the target API changes the timeline of the output results. This was originally due to a typo on my part and not a regular call, but I thought I'd write it down if it's relevant to this issue.

That is, the following will be displayed starting with the newest error (in this case, we get 10 errors for December 21st)

# API There is a slash at the end of the
curl -X GET https://smash.cardano-mainnet.iohk.io/api/v1/errors/383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd/

However, the following will be displayed starting with the oldest error with the current default behavior (i.e., you will only get 10 errors for December 16th)

# API with no trailing slash (canonical call)
curl -X GET https://smash.cardano-mainnet.iohk.io/api/v1/errors/383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd

Hopefully this post will have a positive impact on the problem.

5ch-pool commented 2 years ago

Also, this API has a fromDate option.

If this option is set to fromDate=17.12.2021, you will not get the error for December 21, but if fromDate=18.12.2021, you will get the error for December 21.

This will get you an error on December 21.

curl -X GET https://smash.cardano-mainnet.iohk.io/api/v1/errors/383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd?fromDate=18.12.2021

However, it cannot be obtained in the following

curl -X GET https://smash.cardano-mainnet.iohk.io/api/v1/errors/383dd348581c3c16a981de1178c42f1d3134280f66bed7518b772ffd?fromDate=17.12.2021

As a user, I would like to see any errors after at least the specified date and time.