All pages
Powered by GitBook
1 of 2

Loading...

Loading...

Alerting

mediarithmics modules can trigger alerts to grab the attention of users/integrators on specific points to improve or fix.

Alerts are displayed in the UI, but can also be accessed by API if you want to automate actions or grab them in your own reports.

Alert types

Here are the various alert types that exist:

Type
Trigger

Alert properties

Alerts have several properties associated:

  • type: The type of the alert (e.g., SEGMENT_COMPUTATION_ERROR, SEGMENT_VOLUME_DROP...)

  • id: The unique identifier of the alert

  • datamart_id: The identifier of the datamart associated with the alert

Polymorphism

The alerting system supports polymorphism to accommodate specific fields for various alert types.

For Segment alert

Alert type
Property name
Value

Open/Close

To provide a familiar terminology to users, alerts can be opened or closed. However, in the system, the open/closed state is represented by the archived field. Opening an alert sets the archived field to false, while closing an alert sets it to true. The closed state implies that the alert is no longer active or visible to users.

Preventing duplicates

To avoid having multiple instances of the same alert, the system employs a prevention mechanism. Each alert has count and count_last_ts properties. When triggering a new alert, we check if there is already an active alert for the same target. If such an alert exists, the system increments the count property and updates the count_last_ts to reflect the latest trigger. This prevents the proliferation of identical alerts and ensures that only one alert remains active with an incremented counter.

For example, if a segment has a query error and the issue persists without resolution, the system will increment the count property of the existing alert rather than creating multiple duplicate alerts.

The count_last_ts property stores the timestamp of the most recent trigger, while the created_ts property stores the timestamp of the initial trigger.

Expiration

To manage the storage of alerts and ensure their relevance, the system implements an expiration mechanism. Alerts have an expiration duration associated with them. It is set to the created_ts + 1 month. You can't modify this behavior.

A cleaning job runs regularly to identify and delete all expired alerts from the database. This prevents the accumulation of unnecessary historical data.

API

The API allows users and integrators to interact with alerts through the following functionalities:API

Retrieve a list of alerts based on specific criteria

GET https://api.mediarithmics.com/v1/alerts

.

You have to fill in either the organisation_id, datamart_id or community_id parameters.

Archived alerts are not returned by default. You need to ask them through the archived parameter.

Query Parameters

Name
Type
Description

Change the status of an alert from open to closed or vice versa

PUT https://api.mediarithmics.com/v1/alerts/:alertId

Path Parameters

Name
Type
Description

Query Parameters

Name
Type
Description

DELETE https://api.mediarithmics.com/v1/alerts/:alertId

Path Parameters

Name
Type
Description

No other operations or modifications are permitted through the API.

Users and integrators are restricted from editing any field other than the archived flag for an alert.

organisation_id: The identifier of the organisation associated with the alert

  • community_id: The identifier of the community associated with the alert

  • created_ts: The timestamp indicating when the alert was created

  • archived: A flag indicating whether the alert is closed/archived (true) or open (false)

  • archived_ts: The timestamp indicating when the alert was closed/archived

  • archived_by: The identifier of the user that closed/archived the alert

  • expiration: The expiration timestamp for the alert

  • count: The number of times the alert has been triggered

  • last_count_ts: The timestamp of the most recent trigger of the alert

  • Total drop (in percentage) of the segment volume since the alert was first triggered

    archived

    Boolean

    true to return archived alerts.

    SEGMENT_DEFINITION_ERROR

    Error in the segment definition. More information here

    SEGMENT_VOLUME_DROP

    Segment volume drops by more than a configured threshold (in percentage).

    In the segment computation process, after it has been computed, we check

    • If volumes have dropped by more than XX%

    • If none of the segment labels are in the blocklist when in blocklist mode

    • If any of the segment labels are in the allowlist when in allowlist mode

    INITIAL_LOADING_ERROR

    Error during initial loading of a feed attached to a segment More information here

    SEGMENT_COMPUTATION_ERROR

    Error during the calculation of a segment More information here

    -

    segment

    {

    'segment_id': 'xxx',

    'segment_name': 'The segment name',

    'segment_type': 'USER_QUERY',

    'user_points_count': 71989,

    'feeds_count': 0

    }

    SEGMENT_INITIAL_LOADING

    alert_sub_type

    sub-type of the error:

    • INITIAL_LOADING_EXECUTION_ON_ERROR

    • INITIAL_LOADING_RECORDS_ERROR

    • INITIAL_LOADING_NOT_STARTING

    • INITIAL_LOADING_RUNNING_TOO_LONG

    SEGMENT_INITIAL_LOADING

    feed_id

    ID of the feed concerned by the error

    SEGMENT_VOLUME_DROP

    organisation_id

    Int

    ID of the organisation in which to find alerts

    datamart_id

    Int

    ID of the datamart in which to find alerts

    community_id

    Int

    ID of the community in which to find alerts

    type

    AlertType

    Such as SEGMENT_COMPUTATION_ERROR. See Alert types.

    alertId

    Int

    ID of the alert to edit

    archive

    boolean

    true to close an alert, false to open it.

    alertId

    Int

    ID of the alert to delete

    Paginated API

    drop_rate

    More information here

    Alert configurations

    Alert Configurations allow customization of settings for different alert types within the Alerting module.

    Configurations are used to define specific behavior, thresholds, and rules associated with each alert type. They are dedicated resources.

    Each alert type can have a different set of configurations. By configuring alert types, you can tailor the behavior of the alerts to meet specific requirements.

    Alert configurations can be personalized for a specific organization. This means that each organization can have its own set of configuration values for the alert types. If a configuration is not set, a default value set by mediarithmics will be used.

    Allowed configurations

    Alert configurations are identified by combining three values: config_key, organisation_id, and alert_type. The config_key uniquely identifies a specific configuration setting, while the organisation_id and alert_type specify the organization and alert type to which the configuration belongs.

    Here is a list of available configuration keys and their sample values:

    config
    config_value
    Editable in the UI

    Accessing configurations

    You can list/edit configurations for your organizations by API.

    It is much easier to edit configurations through the UI when available.

    Get all configurations set up for an organisation

    GET https://api.mediarithmics.com/v1/alert_type_configs

    If a configuration from the allowed list is not setup, it won't be returned by this call but fall back to the default platform value in usage.

    Query Parameters

    Name
    Type
    Description

    Creates a new configuration entry

    POST https://api.mediarithmics.com/v1/alert_type_configs/config_key=:configKey/organisation_id=:organisationId/alert_type=:alertType

    Path Parameters

    Name
    Type
    Description

    Request Body

    Name
    Type
    Description

    Change the value or archive a configuration

    PUT https://api.mediarithmics.com/v1/alert_type_configs/config_key=:configKey/organisation_id=:organisationId/alert_type=:alertType

    Path Parameters

    Name
    Type
    Description

    Request Body

    Name
    Type
    Description

    Deletes a config

    DELETE https://api.mediarithmics.com/v1/alert_type_configs/config_key=:configKey/organisation_id=:organisationId/alert_type=:alertType

    Path Parameters

    Name
    Type
    Description

    Archived configurations

    Configurations can be archived using the PUT request. An archived configuration is not used anymore by the platform (fallback to default value) but is easier to reactivate later.

    Value is an integer & reprents a number of hours Defaults to 24

    initial_loading_running_too_long_hours_threshold

    alert_type: SEGMENT_INITIAL_LOADING Threshold in hours after which an alert will be triggered if the initial loading is taking more time than expected

    Value is an integer & reprents a number of hours Defaults to 24

    initial_loading_records_error_threshold

    alert_type: SEGMENT_INITIAL_LOADING An alert will be triggered if the percentage of errors is above the one defined in this config.

    Value is an integer. Defaults to 10

    volume_drops_segment_labels_mode: alert_type: SEGMENT_VOLUME_DROP Defines whether segment labels in volume_drops_segment_labels_ids config are whitelisted or blacklisted. To edit in the UI, go to alerts on the segment list. For more information, see Using the Segments page.

    blacklist | whitelist. Volume drops apply to all segments if not defined

    volume_drops_segment_labels_ids: alert_type: SEGMENT_VOLUME_DROP List of segment labels that will or won't receive volume drop alerts depending on the volume_drops_segment_labels_mode configuration To edit in the UI, go to alerts on the segment list. For more information, see Using the Segments page.

    Sample value: 1,2,3

    Volume drops apply to all segments if not defined

    volume_drops_threshold alert_type: SEGMENT_VOLUME_DROP Percentage of volume drop in a segment that triggers the alert.

    Value is an integer such as 15. Defaults to 10

    organisation_id*

    Int

    ID of the organisation

    configKey*

    string

    Configuration key. Use the list of allowed configurations. Other keys won't have an impact.

    organisationId*

    string

    ID of the organisation for which to create the configuration

    alertType*

    string

    AlertType. Use the list of allowed configurations.

    config_value*

    string

    The value of the configuration. Use the list of allowed configurations for the correct value format, depending on your configuration.

    configKey*

    string

    Configuration key. Use the list of allowed configurations. Other keys won't have an impact.

    organisationId*

    string

    ID of the organisation for which to create the configuration

    alertType*

    string

    AlertType. Use the list of allowed configurations.

    config_value*

    string

    The value of the configuration. Use the list of allowed configurations for the correct value format, depending on your configuration.

    archived

    Boolean

    true to archive a configuration. false to reactivate it. For more information, see Archived configurations.

    configKey*

    string

    Configuration key. Use the list of allowed configurations. Other keys won't have an impact.

    organisationId*

    string

    ID of the organisation for which to create the configuration

    alertType*

    string

    AlertType. Use the list of allowed configurations.

    initial_loading_not_starting_hours_threshold

    alert_type: SEGMENT_INITIAL_LOADING Threshold in hours after which an alert will be triggered if the initial loading hasn't started