mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-23 17:34:17 +03:00
updated stats_counters db to include interval_type for values
This commit is contained in:
parent
fc6224dada
commit
396e0f0c38
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
import uds.models.stats_counters
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
@ -38,6 +39,11 @@ class Migration(migrations.Migration):
|
|||||||
name='mfa',
|
name='mfa',
|
||||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='authenticators', to='uds.mfa'),
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='authenticators', to='uds.mfa'),
|
||||||
),
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='statscounters',
|
||||||
|
name='interval_type',
|
||||||
|
field=models.SmallIntegerField(db_index=True, default=uds.models.stats_counters.StatsCounters.CounterIntervalType['NONE']),
|
||||||
|
),
|
||||||
migrations.RemoveIndex(
|
migrations.RemoveIndex(
|
||||||
model_name='statscounters',
|
model_name='statscounters',
|
||||||
name='uds_stats_c_owner_t_db894d_idx',
|
name='uds_stats_c_owner_t_db894d_idx',
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
|
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
|
||||||
"""
|
"""
|
||||||
import typing
|
import typing
|
||||||
import types
|
import enum
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -49,11 +49,19 @@ class StatsCounters(models.Model):
|
|||||||
"""
|
"""
|
||||||
Statistics about counters (number of users at a given time, number of services at a time, whatever...)
|
Statistics about counters (number of users at a given time, number of services at a time, whatever...)
|
||||||
"""
|
"""
|
||||||
|
# Valid intervals types for counters data
|
||||||
|
class CounterIntervalType(enum.IntEnum):
|
||||||
|
NONE = 0
|
||||||
|
MINUTE = 1
|
||||||
|
HOUR = 2
|
||||||
|
DAY = 3
|
||||||
|
WEEK = 4
|
||||||
|
|
||||||
owner_id = models.IntegerField(db_index=True, default=0)
|
owner_id = models.IntegerField(db_index=True, default=0)
|
||||||
owner_type = models.SmallIntegerField(db_index=True, default=0)
|
owner_type = models.SmallIntegerField(db_index=True, default=0)
|
||||||
counter_type = models.SmallIntegerField(db_index=True, default=0)
|
counter_type = models.SmallIntegerField(db_index=True, default=0)
|
||||||
stamp = models.IntegerField(db_index=True, default=0)
|
stamp = models.IntegerField(db_index=True, default=0)
|
||||||
|
interval_type = models.SmallIntegerField(db_index=True, default=CounterIntervalType.NONE)
|
||||||
value = models.IntegerField(db_index=True, default=0)
|
value = models.IntegerField(db_index=True, default=0)
|
||||||
|
|
||||||
# "fake" declarations for type checking
|
# "fake" declarations for type checking
|
||||||
|
Loading…
Reference in New Issue
Block a user