forked from rucio/rucio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transfers: gather and store transfer statistics
Each time the poller or receiver transitions a transfer to a different state, use the information to update the transfer statistic. The goal is to be able to answer following questions in rucio: - how many successful transfers happened towards RSE1 yesterday - what was the average transfer rate from RSE1 to RSE2 last hour Short-term it will allow to visualize the transfer status. Longer-term, we may use this data to take better scheduling decisions (selection of destination RSE during rule evaluation; selection of source RSE for transfers). Each poller/receiver will gather statistics over a certain time window before committing the aggregated stats gathered over the previous time interval into the database. This reduces the number of database writes at the cost of potentially losing more metrics in case of a crash. We keep track of the total number of failed/successful transfers in the given time window; plus the number of transferred bytes. Metrics will be aggregated regularly into lower-resolution samples. Aggregation is done by summing higher resolution metrics. Lower resolution samples will be stored for a longer period in the database. The behavior was heavily inspired by existing time series databases, like prometheus and influxdb. The possibility to use an external tool for this job was discussed, but rejected.
- Loading branch information
Radu Carpa
committed
Nov 16, 2023
1 parent
6685b7a
commit a9399d9
Showing
9 changed files
with
520 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
lib/rucio/db/sqla/migrate_repo/versions/a08fa8de1545_transfer_stats_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright European Organization for Nuclear Research (CERN) since 2012 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
''' transfer_stats table ''' | ||
|
||
import datetime | ||
|
||
import sqlalchemy as sa | ||
from alembic import context | ||
from alembic.op import (create_table, create_primary_key, create_foreign_key, | ||
create_index, create_check_constraint, drop_table) | ||
|
||
from rucio.db.sqla.types import GUID | ||
# Alembic revision identifiers | ||
revision = 'a08fa8de1545' | ||
down_revision = '4df2c5ddabc0' | ||
|
||
|
||
def upgrade(): | ||
if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: | ||
create_table('transfer_stats', | ||
sa.Column('id', GUID()), | ||
sa.Column('resolution', sa.Integer), | ||
sa.Column('timestamp', sa.DateTime), | ||
sa.Column('dest_rse_id', GUID()), | ||
sa.Column('src_rse_id', GUID()), | ||
sa.Column('activity', sa.String(50)), | ||
sa.Column('files_done', sa.BigInteger), | ||
sa.Column('bytes_done', sa.BigInteger), | ||
sa.Column('files_failed', sa.BigInteger), | ||
sa.Column('created_at', sa.DateTime, default=datetime.datetime.utcnow), | ||
sa.Column('updated_at', sa.DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)) | ||
create_primary_key('TRANSFER_STATS_PK', 'transfer_stats', ['id']) | ||
create_foreign_key('TRANSFER_STATS_DEST_RSE_FK', 'transfer_stats', 'rses', ['dest_rse_id'], ['id']) | ||
create_foreign_key('TRANSFER_STATS_SRC_RSE_FK', 'transfer_stats', 'rses', ['src_rse_id'], ['id']) | ||
create_index('TRANSFER_STATS_KEY_IDX', 'transfer_stats', ['resolution', 'timestamp', 'dest_rse_id', 'src_rse_id', 'activity']) | ||
create_check_constraint('TRANSFER_STATS_CREATED_NN', 'transfer_stats', 'created_at is not null') | ||
create_check_constraint('TRANSFER_STATS_UPDATED_NN', 'transfer_stats', 'updated_at is not null') | ||
|
||
|
||
def downgrade(): | ||
|
||
if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: | ||
drop_table('transfer_stats') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters