metrics package¶
Subpackages¶
- metrics.management package
- metrics.migrations package
- Submodules
- metrics.migrations.0001_initial module
- metrics.migrations.0002_auto_20151007_1352 module
- metrics.migrations.0003_metricsingest module
- metrics.migrations.0004_auto_20151104_1640 module
- metrics.migrations.0005_auto_20160415_1636 module
- metrics.migrations.0006_metricserror module
- metrics.migrations.0007_auto_20161013_2333 module
- metrics.migrations.0008_occurred_datetime module
- metrics.migrations.0009_revert_datetime module
- metrics.migrations.0010_occurred_datetime module
- Module contents
- metrics.test package
Submodules¶
metrics.apps module¶
Defines the application configuration for the scale metrics application
metrics.daily_metrics module¶
Defines the clock event processor for daily system metrics.
-
class
metrics.daily_metrics.
DailyMetricsProcessor
¶ Bases:
job.clock.ClockEventProcessor
This class schedules daily metrics jobs on the cluster.
-
process_event
(event, last_event=None)¶ See
job.clock.ClockEventProcessor.process_event()
.Compares the new event with the last event any missing metrics jobs.
-
metrics.models module¶
Defines the database models for various system metrics.
-
class
metrics.models.
MetricsError
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Tracks all the error metrics grouped by error type.
Parameters: - error (
django.db.models.ForeignKey
) – The error type associated with these metrics. - occurred (
django.db.models.DateField
) – The date when the errors included in this model were created. - total_count (
metrics.models.PlotBigIntegerField
) – The total number of errors of this type that occurred for the day. - created (
django.db.models.DateTimeField
) – When the model was first created.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
GROUPS
= [<metrics.registry.MetricsTypeGroup object>]¶
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
error
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
error_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_next_by_occurred
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_occurred
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <metrics.models.MetricsErrorManager object>¶
-
occurred
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
total_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error (
-
class
metrics.models.
MetricsErrorManager
¶ Bases:
django.db.models.manager.Manager
Provides additional methods for computing daily error metrics.
-
calculate
(date)¶
-
get_metrics_type
(include_choices=False)¶ See
metrics.registry.MetricsTypeProvider.get_metrics_type()
.
-
get_plot_data
(started=None, ended=None, choice_ids=None, columns=None)¶
-
-
class
metrics.models.
MetricsIngest
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Tracks all the ingest metrics grouped by strike process.
Parameters: - strike (
django.db.models.ForeignKey
) – The strike process associated with these metrics. - occurred (
django.db.models.DateField
) – The date when the ingests included in this model were ended. - deferred_count (
metrics.models.PlotBigIntegerField
) – The total number of deferred ingests. - ingested_count (
metrics.models.PlotBigIntegerField
) – The total number of successfully completed ingests. - errored_count (
metrics.models.PlotBigIntegerField
) – The total number of failed ingests. - duplicate_count (
metrics.models.PlotBigIntegerField
) – The total number of duplicated ingests. - file_size_sum (
metrics.models.PlotBigIntegerField
) – The total size of ingested files in bytes. - file_size_min (
metrics.models.PlotBigIntegerField
) – The minimum size of ingested files in bytes. - file_size_max (
metrics.models.PlotBigIntegerField
) – The maximum size of ingested files in bytes. - file_size_avg (
metrics.models.PlotBigIntegerField
) – The average size of ingested files in bytes. - transfer_time_sum (
metrics.models.PlotBigIntegerField
) – The total time spent transferring ingested files in seconds. - transfer_time_min (
metrics.models.PlotIntegerField
) – The minimum time spent transferring ingested files in seconds. - transfer_time_max (
metrics.models.PlotIntegerField
) – The maximum time spent transferring ingested files in seconds. - transfer_time_avg (
metrics.models.PlotIntegerField
) – The average time spent transferring ingested files in seconds. - ingest_time_sum (
metrics.models.PlotBigIntegerField
) – The total time spent ingesting files in seconds. - ingest_time_min (
metrics.models.PlotIntegerField
) – The minimum time spent ingesting files in seconds. - ingest_time_max (
metrics.models.PlotIntegerField
) – The maximum time spent ingesting files in seconds. - ingest_time_avg (
metrics.models.PlotIntegerField
) – The average time spent ingesting files in seconds. - created (
django.db.models.DateTimeField
) – When the model was first created.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
GROUPS
= [<metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>]¶
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
deferred_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
duplicate_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
errored_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file_size_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file_size_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file_size_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file_size_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_next_by_occurred
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_occurred
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
ingest_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
ingest_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
ingest_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
ingest_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
ingested_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <metrics.models.MetricsIngestManager object>¶
-
occurred
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
strike
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
strike_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
total_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
transfer_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
transfer_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
transfer_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
transfer_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- strike (
-
class
metrics.models.
MetricsIngestManager
¶ Bases:
django.db.models.manager.Manager
Provides additional methods for computing daily ingest metrics.
-
calculate
(date)¶
-
get_metrics_type
(include_choices=False)¶ See
metrics.registry.MetricsTypeProvider.get_metrics_type()
.
-
get_plot_data
(started=None, ended=None, choice_ids=None, columns=None)¶
-
-
class
metrics.models.
MetricsJobType
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Tracks all the job execution metrics grouped by job type.
Parameters: - job_type (
django.db.models.ForeignKey
) – The type of job associated with these metrics. - occurred (
django.db.models.DateField
) – The date when the job executions included in this model were ended. - completed_count (
metrics.models.PlotBigIntegerField
) – The total number of completed job executions. - failed_count (
metrics.models.PlotBigIntegerField
) – The total number of failed job executions. - canceled_count (
metrics.models.PlotBigIntegerField
) – The total number of canceled job executions. - total_count (
metrics.models.PlotBigIntegerField
) – The total number of ended job executions (completed, failed, canceled). - error_system_count (
metrics.models.PlotBigIntegerField
) – The number of failed job executions due to a system error. - error_data_count (
metrics.models.PlotBigIntegerField
) – The number of failed job executions due to a data error. - error_algorithm_count (
metrics.models.PlotBigIntegerField
) – The number of failed job executions due to an algorithm error. - queue_time_sum (
metrics.models.PlotBigIntegerField
) – The total time job executions were queued in seconds. - queue_time_min (
metrics.models.PlotIntegerField
) – The minimum time a job execution was queued in seconds. - queue_time_max (
metrics.models.PlotIntegerField
) – The maximum time a job execution was queued in seconds. - queue_time_avg (
metrics.models.PlotIntegerField
) – The average time job executions were queued in seconds. - pre_time_sum (
metrics.models.PlotBigIntegerField
) – The total time job executions were executing pre-task steps in seconds. - pre_time_min (
metrics.models.PlotIntegerField
) – The minimum time a job execution was executing pre-task steps in seconds. - pre_time_max (
metrics.models.PlotIntegerField
) – The maximum time a job execution was executing pre-task steps in seconds. - pre_time_avg (
metrics.models.PlotIntegerField
) – The average time job executions were executing pre-task steps in seconds. - job_time_sum (
metrics.models.PlotBigIntegerField
) – The total time job executions were executing the actual job task in seconds. - job_time_min (
metrics.models.PlotIntegerField
) – The minimum time a job execution was executing the actual job task in seconds. - job_time_max (
metrics.models.PlotIntegerField
) – The maximum time a job execution was executing the actual job task in seconds. - job_time_avg (
metrics.models.PlotIntegerField
) – The average time job executions were executing the actual job task in seconds. - post_time_sum (
metrics.models.PlotBigIntegerField
) – The total time job executions were executing post-task steps in seconds. - post_time_min (
metrics.models.PlotIntegerField
) – The minimum time a job execution was executing post-task steps in seconds. - post_time_max (
metrics.models.PlotIntegerField
) – The maximum time a job execution was executing post-task steps in seconds. - post_time_avg (
metrics.models.PlotIntegerField
) – The average time job executions were executing post-task steps in seconds. - run_time_sum (
metrics.models.PlotBigIntegerField
) – The total time job executions were running in seconds. - run_time_min (
metrics.models.PlotIntegerField
) – The minimum time a job execution was running in seconds. - run_time_max (
metrics.models.PlotIntegerField
) – The maximum time a job execution was running in seconds. - run_time_avg (
metrics.models.PlotIntegerField
) – The average time job executions were running in seconds. - stage_time_sum (
metrics.models.PlotBigIntegerField
) – The total time job executions spent in system staging between tasks in seconds. - stage_time_min (
metrics.models.PlotIntegerField
) – The minimum time a job execution spent in system staging between tasks in seconds. - stage_time_max (
metrics.models.PlotIntegerField
) – The maximum time a job execution spent in system staging between tasks in seconds. - stage_time_avg (
metrics.models.PlotIntegerField
) – The average time job executions spent in system staging between tasks in seconds. - created (
django.db.models.DateTimeField
) – When the model was first created.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
GROUPS
= [<metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>, <metrics.registry.MetricsTypeGroup object>]¶
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
canceled_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
completed_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
error_algorithm_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
error_data_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
error_system_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
failed_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created
(*moreargs, **morekwargs)¶
-
get_next_by_occurred
(*moreargs, **morekwargs)¶
-
get_previous_by_created
(*moreargs, **morekwargs)¶
-
get_previous_by_occurred
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
job_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
job_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
job_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
job_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
job_type
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
job_type_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <metrics.models.MetricsJobTypeManager object>¶
-
occurred
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
post_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
post_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
post_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
post_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
pre_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
pre_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
pre_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
pre_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
queue_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
queue_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
queue_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
queue_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
run_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
run_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
run_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
run_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stage_time_avg
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stage_time_max
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stage_time_min
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
stage_time_sum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
total_count
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- job_type (
-
class
metrics.models.
MetricsJobTypeManager
¶ Bases:
django.db.models.manager.Manager
Provides additional methods for computing daily job type metrics.
-
calculate
(date)¶
-
get_metrics_type
(include_choices=False)¶ See
metrics.registry.MetricsTypeProvider.get_metrics_type()
.
-
get_plot_data
(started=None, ended=None, choice_ids=None, columns=None)¶
-
-
class
metrics.models.
PlotBigIntegerField
(verbose_name=None, name=None, aggregate=None, group=None, units=None, **kwargs)¶ Bases:
django.db.models.fields.BigIntegerField
Custom field used to indicate a model attribute can be used as a plot value.
Parameters: - verbose_name (string) – The display name of the field.
- name (string) – The internal database name of the field.
- aggregate (string) – The math operation used to compute the value. Examples: avg, max, min, sum
- group (string) – The base field name used to group together related values. For example, a field may have several aggregate variations that all reference the same base attribute.
- units (string) – The mathematical units applied to the value. Examples: seconds, minutes, hours
-
class
metrics.models.
PlotIntegerField
(verbose_name=None, name=None, aggregate=None, group=None, units=None, **kwargs)¶ Bases:
django.db.models.fields.IntegerField
Custom field used to indicate a model attribute can be used as a plot value.
Parameters: - verbose_name (string) – The display name of the field.
- name (string) – The internal database name of the field.
- aggregate (string) – The math operation used to compute the value. Examples: avg, max, min, sum
- group (string) – The base field name used to group together related values. For example, a field may have several aggregate variations that all reference the same base attribute.
- units (string) – The mathematical units applied to the value. Examples: seconds, minutes, hours
metrics.registry module¶
Defines general classes used to manage metrics
-
class
metrics.registry.
MetricsPlotData
(column, min_x=None, max_x=None, min_y=None, max_y=None, values=None)¶ Bases:
object
Represents a series of plot values for a single metrics type column.
Parameters: - column (
metrics.registry.MetricsTypeColumn
) – The metrics type column definition. - min_x (datetime.date) – The minimum x-axis value, which is always a date.
- max_x (datetime.date) – The maximum x-axis value, which is always a date.
- min_y (int) – The minimum y-axis value, which is always a number.
- max_y (int) – The maximum y-axis value, which is always a number.
- values (list[
metrics.registry.MetricsPlotValue
]) – A list of the actual plot values in the series.
-
classmethod
create
(query_set, date_field, choice_field, choice_ids, columns)¶ Creates new metrics plot data records from a query set of database models.
Parameters: - query_set (
django.models.QuerySet
) – A set of database models that are being counted towards metrics. - date_field (string) – The name of the field within each model that contains the recorded date.
- choice_field (string) – The name of the field within each model that contains the choice model relation.
- choice_ids ([string]) – A list of related model identifiers to query.
- columns (list[
metrics.registry.MetricsTypeColumn
]) – A list of metrics type column definitions that should be included.
Returns: The plot data models that were created.
Return type: - query_set (
- column (
-
class
metrics.registry.
MetricsPlotValue
(choice_id, datetime, value=0, count=0, total=0)¶ Bases:
object
Represents a single value within a series of values for a metrics type column.
Parameters: - choice_id (string) – The unique identifier of the choice model associated with the value.
- date (datetime.date) – The date when the plot value occurred.
- value (int) – The actual plot value that was recorded.
- count (int) – The number of records contributing to this plot value.
- total (int) – The total values of all records contributing to this plot value.
-
class
metrics.registry.
MetricsType
(name, title=None, description=None, filters=None, groups=None, columns=None, choices=None)¶ Bases:
object
Represents a type of metrics that can be queried.
Parameters: - name (string) – The system name of the metrics type.
- title (string) – The human-friendly display name of the metrics type.
- description (string) – A longer description of the metrics type.
- filters (list[
metrics.registry.MetricsTypeFilter
]) – A list of filter parameter definitions supported by the metrics type. - columns (list[
metrics.registry.MetricsTypeColumn
]) – A list of available columns supported by the metrics type. - choices (object) – A list of available models that can be used as filters for the metrics type. Each metrics type can use its own choice models, but any fields listed as filters must be included here at a minimum.
-
get_column
(column_name)¶ Gets the column model associated with the given name.
Parameters: column_name (string) – The name of the column to lookup. Returns: The metrics type column. Return type: metrics.registry.MetricsTypeColumn
-
get_column_names
()¶ Gets a list of all column names for this metrics type.
Column names can be used to select a specific series of plot values.
Returns: The metrics type column names. Return type: [string]
-
get_column_set
(column_names=None, group_names=None)¶ Gets the combined set of column models derived from the given names and groups.
Column names use a simple lookup to get the corresponding column model and the group name is used to find all columns with a matching a value. Duplicates are then removed to produce the final result.
Parameters: - column_names ([string]) – The names of the columns to lookup.
- group_names ([string]) – The names of the groups to lookup.
Returns: The metrics type columns.
Return type:
-
get_group_columns
(group_names)¶ Gets the set of column models associated with the given groups.
The group name is used to find all columns with a matching a value. Duplicates are then removed to produce the final result.
Parameters: group_names ([string]) – The names of the groups to lookup. Returns: The metrics type columns. Return type: set[ metrics.registry.MetricsTypeColumn
]
-
set_columns
(model_class, field_types)¶ Sets all the metric type columns by inspecting the given database model.
Parameters: - model_class (
django.db.models.Model
) – The class type of the metrics model to inspect. - field_types (list[
django.db.models.Field
]) – The model field types to include as metrics columns.
Returns: The metrics type columns.
Return type: - model_class (
-
class
metrics.registry.
MetricsTypeColumn
(name, title=None, description=None, units=None, group=None, aggregate=None)¶ Bases:
object
Represents an attribute of a metrics type that can be selected as a series of plot values.
Parameters: - name (string) – The system name of the column.
- title (string) – The human-friendly display name of the column.
- description (string) – A longer description of the column.
- units (string) – The mathematical units applied to the value. Examples: seconds, minutes, hours
- group (string) – The base field name used to group together related values. For example, a field may have several aggregate variations that all reference the same base attribute.
- aggregate (string) – The math operation used to compute the value. Examples: avg, max, min, sum
-
exception
metrics.registry.
MetricsTypeError
¶ Bases:
exceptions.Exception
Error class used when there is a problem generating metrics.
-
class
metrics.registry.
MetricsTypeFilter
(param, param_type=u'string')¶ Bases:
object
Represents a parameter that can be used to filter metrics type values.
Parameters: - param (string) – The name of the filter parameter.
- param_type – The data type of the filter parameter. Examples: bool, date, datetime, float, int, string, time
-
class
metrics.registry.
MetricsTypeGroup
(name, title=None, description=None)¶ Bases:
object
Represents a group of attributes for a metrics type that can be selected as a series of plot values.
Parameters: - name (string) – The system name of the group.
- title (string) – The human-friendly display name of the group.
- description (string) – A longer description of the group.
-
class
metrics.registry.
MetricsTypeProvider
¶ Bases:
object
Base class used to handle requests for specific types of metrics.
-
calculate
(date)¶ Calculates and saves new metrics models grouped by the given date.
Parameters: date (datetime.date) – The target date metrics should be based on.
-
get_metrics_type
(include_choices=False)¶ Gets the metrics type model handled by this provider.
Parameters: include_choices (bool) – Whether or not to include all the possible model choices that can be used to filter metrics generated by this provider. Since the list of choices can be large and require additional database queries they are not included by default. Returns: The metrics type for this provider. Return type: metrics.registry.MetricsType
-
get_plot_data
(started=None, ended=None, choice_ids=None, columns=None)¶ Gets a list of plot values based on the given query parameters.
Parameters: - started (datetime.date) – The start of the time range to query.
- ended (datetime.date) – The end of the time range to query.
- choice_ids ([string]) – A list of related model identifiers to query.
- columns ({
metrics.registry.MetricsTypeColumn
}) – A list of metric columns to include from the metric type.
Returns: A series of plot values that match the query.
Return type:
-
-
metrics.registry.
get_metrics_type
(name, include_choices=False)¶ Gets the metrics type registered with the given name.
Parameters: - name (string) – The name of the metrics type to retrieve.
- include_choices (bool) – Whether or not to include all the possible model choices that can be used to filter metrics generated by this provider. Since the list of choices can be large and require additional database queries they are not included by default.
Returns: The metrics type list.
Return type:
-
metrics.registry.
get_metrics_types
()¶ Gets a list of all registered metrics types.
Returns: The metrics type list. Return type: list[ metrics.registry.MetricsType
]
-
metrics.registry.
get_provider
(name)¶ Gets the metrics provider registered with the given name.
Parameters: name (string) – The name of the metrics provider to retrieve. Returns: The metrics provider associated with the name. Return type: metrics.registry.MetricsTypeProvider
:raises
metrics.registry.MetricsTypeError
: If the registration is missing.
-
metrics.registry.
get_providers
()¶ Gets a list of all registered metrics providers.
Returns: The current metrics provider list. Return type: list[ metrics.registry.MetricsTypeProvider
]
-
metrics.registry.
get_serializer
(name)¶ Gets the model serializer class for the given metrics type name.
Parameters: name (string) – The name of the metrics type serializer to retrieve. Returns: The class used to serialize the metrics type. Return type: metrics.serializers.MetricsTypeDetailsSerializer
-
metrics.registry.
register_provider
(provider, serializer_class=None)¶ Registers the given metrics type definition to be called by the metrics management system.
Parameters: - provider (
metrics.registry.MetricsTypeProvider
) – The provider instance that is used to access the metrics. - serializer_class (
metrics.serializers.MetricsTypeDetailsSerializer
) – The class used to serialize metrics generated by the provider.
- provider (
metrics.serializers module¶
Defines the serializers for metrics
-
class
metrics.serializers.
MetricsErrorDetailsSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
metrics.serializers.MetricsTypeDetailsSerializer
Converts ingest metrics details model fields to REST output
-
class
ErrorBaseSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
util.rest.ModelIdSerializer
Converts error model fields to REST output
-
class
-
class
metrics.serializers.
MetricsIngestDetailsSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
metrics.serializers.MetricsTypeDetailsSerializer
Converts ingest metrics details model fields to REST output
-
class
StrikeBaseSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
util.rest.ModelIdSerializer
Converts strike model fields to REST output
-
class
-
class
metrics.serializers.
MetricsJobTypeDetailsSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
metrics.serializers.MetricsTypeDetailsSerializer
Converts job type metrics details model fields to REST output
-
class
JobTypeBaseSerializerV6
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
util.rest.ModelIdSerializer
Converts job type model fields to REST output
-
class
-
class
metrics.serializers.
MetricsPlotMultiSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
metrics.serializers.MetricsPlotSerializer
Converts metrics plot values to REST output
-
class
metrics.serializers.
MetricsPlotSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts metrics plot values to REST output
-
class
metrics.serializers.
MetricsPlotValueSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts metrics plot values to REST output
-
to_representation
(obj)¶
-
-
class
metrics.serializers.
MetricsTypeBaseSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts metrics type model fields to REST output
-
class
metrics.serializers.
MetricsTypeColumnSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts metrics column model fields to REST output
-
class
metrics.serializers.
MetricsTypeDetailsSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
metrics.serializers.MetricsTypeSerializer
Converts metrics details model fields to REST output
-
class
metrics.serializers.
MetricsTypeFilterSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts metrics filter model fields to REST output
-
class
metrics.serializers.
MetricsTypeGroupSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts metrics group model fields to REST output
-
class
metrics.serializers.
MetricsTypeSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)¶ Bases:
rest_framework.serializers.Serializer
Converts metrics type model fields to REST output
metrics.urls module¶
Defines the URLs for the RESTful metrics services
metrics.views module¶
Defines the views for the RESTful metrics services
-
class
metrics.views.
MetricDetailsView
(**kwargs)¶ Bases:
rest_framework.generics.RetrieveAPIView
This view is the endpoint for retrieving details of metrics.
-
retrieve
(request, name)¶ Retrieves the details for metrics and return them in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
retrieve_impl
(request, name)¶ Retrieves the details for metrics and return them in JSON form
Parameters: - request (
rest_framework.request.Request
) – the HTTP GET request - name (string) – the name of the metrics detail to retrieve.
Return type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
- request (
-
retrieve_v6
(request, name)¶ Gets v6 metrics type details in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
-
class
metrics.views.
MetricPlotView
(**kwargs)¶ Bases:
rest_framework.generics.ListAPIView
This view is the endpoint for retrieving plot values of metrics.
-
list
(request, name)¶ Retrieves the plot values for metrics and return them in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
list_impl
(request, name)¶ Retrieves the plot values for metrics and return them in JSON form
Parameters: - request (
rest_framework.request.Request
) – the HTTP GET request - name (string) – the name of the metrics detail to retrieve.
Return type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
- request (
-
list_v6
(request, name)¶ Gets v6 plot values for metrics in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
queryset
= []¶
-
-
class
metrics.views.
MetricsGanttChartRecipeTypesView
(**kwargs)¶ Bases:
rest_framework.generics.ListAPIView
This view is the endpoint for retrieving gantt chart values for recipe types
-
list
(request, name)¶ Retrieves the gantt chart values and return them in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
list_impl
(request, name)¶ Retrieves the plot values for metrics and return them in JSON form
Parameters: - request (
rest_framework.request.Request
) – the HTTP GET request - name (string) – the name of the metrics detail to retrieve.
Return type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
- request (
-
list_v6
(request, name)¶ Gets v6 plot values for metrics in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
queryset
= []¶
-
-
class
metrics.views.
MetricsView
(**kwargs)¶ Bases:
rest_framework.generics.ListAPIView
This view is the endpoint for retrieving available types of metrics.
-
list
(request)¶ Retrieves the metrics types and returns it in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
list_impl
(request)¶ Retrieves the metrics types and returns it in JSON form
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
list_v6
(request)¶ Gets v6 metrics types
Parameters: request ( rest_framework.request.Request
) – the HTTP GET requestReturn type: rest_framework.response.Response
Returns: the HTTP response to send back to the user
-
queryset
= [<metrics.registry.MetricsType object>, <metrics.registry.MetricsType object>, <metrics.registry.MetricsType object>]¶
-
serializer_class
¶ alias of
MetricsTypeSerializer
-