Models

Models.

class controller.sentry.models.App(*args, **kwargs)[source]

Bases: Model

App Models.

Parameters:
  • reference (CharField) – Primary key: Reference

  • last_seen (DateTimeField) – Last seen

  • default_sample_rate (FloatField) – Default sample rate

  • active_sample_rate (FloatField) – Active sample rate

  • active_window_end (DateTimeField) – Active window end

  • env (CharField) – Env

  • command (CharField) – Command

  • wsgi_ignore_path (ArrayField) – Wsgi ignore path. A list of path to ignore, matched using fill match ==

  • wsgi_ignore_user_agent (ArrayField) – Wsgi ignore user agent. A list of user agent to ignore, matched with startswith

  • wsgi_collect_metrics (BooleanField) – Wsgi metrics

  • wsgi_metrics (JSONField) – Wsgi metrics

  • celery_ignore_task (ArrayField) – Celery ignore task

  • celery_collect_metrics (BooleanField) – Celery metrics

  • celery_metrics (JSONField) – Celery metrics

Relationship fields:

Parameters:

project (ForeignKey to Project) – Project (related name: apps)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

active_sample_rate

FloatField

Active sample rate

Type:

Type

active_window_end

DateTimeField

Active window end

Type:

Type

celery_collect_metrics

BooleanField

Celery metrics

Type:

Type

celery_ignore_task

ArrayField

Celery ignore task

Type:

Type

celery_metrics

JSONField

Celery metrics

Type:

Type

command

CharField

Command

Type:

Type

default_sample_rate

FloatField

Default sample rate

Type:

Type

env

CharField

Env

Type:

Type

get_metric(metric_type: MetricType) tuple[bool, dict][source]

Get metrics from controller.sentry.choices.MetricType.

Parameters:

metric_type (MetricType) – Metric type

Returns:

Is collecting metrics dict: The metric value

Return type:

bool

last_seen

DateTimeField

Last seen

Type:

Type

merge(validated_data: dict)[source]

Merge Metrics.

Parameters:

validated_data (dict) – new data

objects = <django.db.models.Manager object>
project

ForeignKey to Project

Project (related name: apps)

Type:

Type

project_id

Internal field, use project instead.

reference

CharField

Primary key: Reference

Type:

Type

set_metric(metric_type: MetricType, metric_state: bool)[source]

Set metrics.

Parameters:
  • metric_type (MetricType) – Metric type

  • metric_state (bool) – Should collect metrics

wsgi_collect_metrics

BooleanField

Wsgi metrics

Type:

Type

wsgi_ignore_path

ArrayField

Wsgi ignore path. A list of path to ignore, matched using fill match ==

Type:

Type

wsgi_ignore_user_agent

ArrayField

Wsgi ignore user agent. A list of user agent to ignore, matched with startswith

Type:

Type

wsgi_metrics

JSONField

Wsgi metrics

Type:

Type

class controller.sentry.models.Event(*args, **kwargs)[source]

Bases: Model

Event Models.

Parameters:

Relationship fields:

Parameters:

project (ForeignKey to Project) – Project (related name: events)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

get_next_by_timestamp(*, field=<django.db.models.DateTimeField: timestamp>, is_next=True, **kwargs)

Finds next instance based on timestamp. See get_next_by_FOO() for more information.

get_previous_by_timestamp(*, field=<django.db.models.DateTimeField: timestamp>, is_next=False, **kwargs)

Finds previous instance based on timestamp. See get_previous_by_FOO() for more information.

get_type_display(*, field=<django.db.models.CharField: type>)

Shows the label of the type. See get_FOO_display() for more information.

objects = <django.db.models.Manager object>
project

ForeignKey to Project

Project (related name: events)

Type:

Type

project_id

Internal field, use project instead.

reference

UUIDField

Primary key: Reference

Type:

Type

timestamp

DateTimeField

Timestamp

Type:

Type

type

CharField

Type

Choices:

  • FIRING

  • DISCARD

Type:

Type

class controller.sentry.models.Project(*args, **kwargs)[source]

Bases: Model

Project Models.

Parameters:
  • sentry_id (CharField) – Primary key: Sentry id

  • sentry_project_slug (CharField) – Sentry project slug

  • detection_param (JSONField) – Detection param

  • detection_result (JSONField) – Detection result

Relationship fields:

Parameters:

last_event (ForeignKey to Event) – Last event (related name: +)

Reverse relationships:

Parameters:
exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

apps

Reverse ForeignKey from App

All apps of this project (related name of project)

Type:

Type

detection_param

JSONField

Detection param

Type:

Type

detection_result

JSONField

Detection result

Type:

Type

events

Reverse ForeignKey from Event

All events of this project (related name of project)

Type:

Type

last_event

ForeignKey to Event

Last event (related name: +)

Type:

Type

last_event_id

Internal field, use last_event instead.

objects = <django.db.models.Manager object>
sentry_id

CharField

Primary key: Sentry id

Type:

Type

sentry_project_slug

CharField

Sentry project slug

Type:

Type

controller.sentry.models.settings_default_value(key: str) Any[source]

This function returns the default value from settings.

Parameters:

key (str) – The key to retrieve from settings.

Returns:

The settings.

Return type:

Any