Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Get directory size statistics

GET /data/{id}/dir_size_stats

Retrieves historical size statistics over time for a directory. The response includes only the information pertaining to the queried provider; in order to collect globally-complete statistics, all providers supporting the space must be queried. There may be discrepancies in statistics such as logical size of data, which stem from synchronization delays between providers.

Size statistics over time are available only for directories. They are collected hierarchically i.e. for a certain directory, its statistics are a sum of statistics for the directory (regarding its direct children), and the statistics from all its subdirectories. Additionally, size statistics for the space directory encompass relevant information from archives.

This endpoint requires the size statistics to be enabled for the containing space on the queried provider. Otherwise, an adequate error will be returned.

Two request modes are supported:

  • layout - returns information about the structure of stats collection, i.e. the names of the available time series and metrics within them
  • slice - returns a slice of statistics as a collection of slices of requested time series and metrics

The following time series are available for each directory:

  • logical_size - total size of file data contained in the directory, i.e. the sum of logical sizes of all regular files in its subtree. If a file has multiple hardlinks in the subtree, each hardlink is counted separately.
  • virtual_size - consolidated logical size, where hardlinks of the same file in the subtree are counted only once. Represents the storage space required for a complete replica of the directory.
  • physical_size_$STORAGE_ID - actual amount of storage consumed on a given storage backend by all regular files in the directory’s subtree. May be smaller than the virtual size if some file replicas are incomplete. Only the storage backends owned by the queried providers are returned.
  • reg_file_and_link_count - the count of regular files, hard links, and symbolic links contained in the directory.
  • dir_count - the count of directories contained in the directory.
  • file_error_count - the count of error occurrences when the statistics mechanisms were not able to gather size information about a certain file.
  • dir_error_count - like above, for directories.

If the values of file_errors_count or dir_errors_count are not zero, the statistics may not be accurate.

The following metrics are available for each time series: day, hour, minute, month.

Example cURL requests

Get the layout of directory size statistics

curl -H "X-Auth-Token: $TOKEN" \
-X GET "https://$PROVIDER_HOST/api/v3/oneprovider/data/$DIR_ID/dir_size_stats" \
-H "Content-Type: application/json" -d '{
    "mode": "layout"  
}'

{
    "layout": {
        "total_size": [
            "day",
            "hour",
            "minute",
            "month"
        ],
        "storage_use_7ab46e96fdb27a2694493c2c5bd7491dch8f55": [...],
        "reg_file_and_link_count": [...],
        "file_errors_count": [...],
        "dir_errors_count": [...],
        "dir_count": [...]
    }
}

Get a slice of directory size statistics

curl -H "X-Auth-Token: $TOKEN" \
-X GET "https://$PROVIDER_HOST/api/v3/oneprovider/data/$DIR_ID/dir_size_stats" \
-H "Content-Type: application/json" -d '{
    "mode": "slice",
    "extendedInfo": true,
    "layout": {
        "total_size": [
            "minute"
        ],
        "storage_use_7ab46e96fdb27a2694493c2c5bd7491dch8f55": [
            "minute"
        ]
    },
    "startTimestamp": 1687513285,
    "stopTimestamp": 1687499802,
    "windowLimit": 31
}'

{
    "slice": {
        "total_size": {
            "minute": [
                {
                    "value": 883365,
                    "timestamp": 1687513260,
                    "lastMeasurementTimestamp": 1687513287,
                    "firstMeasurementTimestamp": 1687513287
                },
                ...
            ]
        },
        "storage_use_7ab46e96fdb27a2694493c2c5bd7491dch8f55": {
            "minute": [
                {
                    "value": 56280,
                    "timestamp": 1687513260,
                    "lastMeasurementTimestamp": 1687513287,
                    "firstMeasurementTimestamp": 1687513287
                },
                ...
            ]
        }
    }
}'

Path parameters

Parameter Type & Description
id required
string

Directory Id

Request body

application/json

Query body.

PropertyType & Description
mode
string
Enum:
layoutslice

Request Examples

Shell
oneprovider-rest-cli getDirectorySizeStats id=$DIR_ID

Responses

application/json
200

Query response. Depending on the query mode, contains the layout or slice object.

PropertyType & Description
layout
object (TimeSeriesLayout)

A map of arrays representing the structure of a time series collection - the names of time series and metrics within them.

slice
object (TimeSeriesSlice)

Listing of time series windows per time series and per metric within a time series.

Example

application/json
{
  "layout": {
    "total_size": [
      "day",
      "hour",
      "minute",
      "month"
    ],
    "storage_use_7ab46e96fdb27a2694493c2c5bd7491dch8f55": [
      "day",
      "hour",
      "minute",
      "month"
    ],
    "reg_file_and_link_count": [
      "day",
      "hour",
      "minute",
      "month"
    ],
    "file_errors_count": [
      "day",
      "hour",
      "minute",
      "month"
    ],
    "dir_errors_count": [
      "day",
      "hour",
      "minute",
      "month"
    ],
    "dir_count": [
      "day",
      "hour",
      "minute",
      "month"
    ]
  },
  "slice": {
    "total_size": {
      "minute": [
        {
          "value": 883365,
          "timestamp": 1687513260,
          "lastMeasurementTimestamp": 1687513287,
          "firstMeasurementTimestamp": 1687513287
        }
      ]
    },
    "storage_use_7ab46e96fdb27a2694493c2c5bd7491dch8f55": {
      "minute": [
        {
          "value": 56280,
          "timestamp": 1687513260,
          "lastMeasurementTimestamp": 1687513287,
          "firstMeasurementTimestamp": 1687513287
        }
      ]
    }
  }
}
400

Invalid request.

PropertyType & Description
error
object (ErrorJson)

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

ctx required
object (ErrorJsonCtx)

Technical information about error.

timestamp required
integer

Timestamp in milliseconds.

serviceReleaseVersion required
string

Release version of a product, for example "25.0".

serviceId required
string

Identifier of a service instance — either Oneprovider Id or "onezone".

serviceDomain required
string

Domain of the service.

serviceBuildVersion required
string

Build version of the service.

service required
string

Short name of service.

Enum:
ozwopwozpopp
onedataErrorsRevision required
string

Revision of onedata-errors repo, where the error is defined.

module required
string

Module where the error occurred.

line required
integer

Line number in the module where the error occurred.

Example

application/json
{
  "error": {
    "id": "example",
    "description": "This is an example error.",
    "ctx": {
      "timestamp": 1750762637248,
      "serviceReleaseVersion": "25.0",
      "serviceId": "a7ee2722915b8bf7fb064eb65087cc61ch9357",
      "serviceDomain": "dev-oneprovider-krakow.default.svc.cluster.local",
      "serviceBuildVersion": "231-g8d26f953c3",
      "service": "opw",
      "onedataErrorsRevision": "ca3af8cb",
      "module": "metadata_req",
      "line": 45
    }
  }
}
403

Forbidden request.

PropertyType & Description
error
object (ErrorJson)

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

ctx required
object (ErrorJsonCtx)

Technical information about error.

timestamp required
integer

Timestamp in milliseconds.

serviceReleaseVersion required
string

Release version of a product, for example "25.0".

serviceId required
string

Identifier of a service instance — either Oneprovider Id or "onezone".

serviceDomain required
string

Domain of the service.

serviceBuildVersion required
string

Build version of the service.

service required
string

Short name of service.

Enum:
ozwopwozpopp
onedataErrorsRevision required
string

Revision of onedata-errors repo, where the error is defined.

module required
string

Module where the error occurred.

line required
integer

Line number in the module where the error occurred.

Example

application/json
{
  "error": {
    "id": "example",
    "description": "This is an example error.",
    "ctx": {
      "timestamp": 1750762637248,
      "serviceReleaseVersion": "25.0",
      "serviceId": "a7ee2722915b8bf7fb064eb65087cc61ch9357",
      "serviceDomain": "dev-oneprovider-krakow.default.svc.cluster.local",
      "serviceBuildVersion": "231-g8d26f953c3",
      "service": "opw",
      "onedataErrorsRevision": "ca3af8cb",
      "module": "metadata_req",
      "line": 45
    }
  }
}
500

Internal server error.

PropertyType & Description
error
object (ErrorJson)

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

ctx required
object (ErrorJsonCtx)

Technical information about error.

timestamp required
integer

Timestamp in milliseconds.

serviceReleaseVersion required
string

Release version of a product, for example "25.0".

serviceId required
string

Identifier of a service instance — either Oneprovider Id or "onezone".

serviceDomain required
string

Domain of the service.

serviceBuildVersion required
string

Build version of the service.

service required
string

Short name of service.

Enum:
ozwopwozpopp
onedataErrorsRevision required
string

Revision of onedata-errors repo, where the error is defined.

module required
string

Module where the error occurred.

line required
integer

Line number in the module where the error occurred.

Example

application/json
{
  "error": {
    "id": "example",
    "description": "This is an example error.",
    "ctx": {
      "timestamp": 1750762637248,
      "serviceReleaseVersion": "25.0",
      "serviceId": "a7ee2722915b8bf7fb064eb65087cc61ch9357",
      "serviceDomain": "dev-oneprovider-krakow.default.svc.cluster.local",
      "serviceBuildVersion": "231-g8d26f953c3",
      "service": "opw",
      "onedataErrorsRevision": "ca3af8cb",
      "module": "metadata_req",
      "line": 45
    }
  }
}