ydb-platform / ydb

YDB is an open source Distributed SQL Database that combines high availability and scalability with strong consistency and ACID transactions
https://ydb.tech
Apache License 2.0
4k stars 565 forks source link

[viewer api] return storage consumption and limit separated by storage type #3430

Closed antonkovalenko closed 5 months ago

artemmufazalov commented 7 months ago

endpoint: viewer/json/tenantinfo

We need following data:

Currently, we have following data structure from backend:

{
DatabaseQuotas: {
    "data_size_hard_quota": "53687091200" // Limit for tablet storage
},
Metrics: {
    "Storage": "3885878" // Tablet storage
},
StorageAllocatedSize: "12345", // Blob storage
StorageAllocatedLimit: "12345", // Blob storage limit
StorageUsage: [
    {
        "Type": "SSD",
        "Size": "12345", // SSD Blob storage
        "Limit": "12345", // SSD Blob storage limit
    },
    {
        "Type": "HDD"
    }
]
}

In the UI we check values, which are present and use them.

It will be better to have simplified structure, which could be used by UI without additional calculations:

{
"TabletStorage": [
     {
        "Type": "SSD",
        "Size": "12345", // SSD Tablet storage
        "Limit": "12345", // SSD Tablet storage limit (data_size_hard_quota)
    },
    {
        "Type": "HDD",
        "Size": "12345", // HDD Tablet storage
        "Limit": "12345", // HDD Tablet storage limit 
    },
],
"BlobStorage" : [
    {
        "Type": "SSD",
        "Size": "12345", // SSD Blob storage
        "Limit": "12345", // SSD Blob storage limit
    },
    {
        "Type": "HDD",
        "Size": "12345", // HDD Blob storage
        "Limit": "12345", // HDD Blob storage limit
    }
]
}
StekPerepolnen commented 7 months ago

https://github.com/ydb-platform/ydb/pull/3463

StekPerepolnen commented 7 months ago

the final result looks like

{
"StorageUsage": [
     {
        "Type": "SSD",
        "Size": "12345", // SSD Blob storage
        "Limit": "12345", // SSD Blob storage limit
    },
    {
        "Type": "HDD"
    },
],
"QuotaUsage" : [
    {
        "Type": "SSD",
        "Size": "12345", // Tablet storage
        "Limit": "12345", // Tablet limit (data_size_hard_quota)
    },
    {
        "Type": "HDD"
    }
]
}

so, I've decided keep StorageUsage like before (there is no any change here)

artemmufazalov commented 7 months ago

so, I've decided keep StorageUsage like before (there is no any change here)

Thanks, look great