View Source Plausible.Ingestion.Event (Plausible v0.0.1)

This module exposes the build_and_buffer/1 function capable of turning %Plausible.Ingestion.Request{} into a series of events that in turn are uniformly either buffered in batches (to Clickhouse) or dropped (e.g. due to spam blocklist) from the processing pipeline.

Summary

Types

@type drop_reason() ::
  :bot
  | :spam_referrer
  | Plausible.Site.GateKeeper.policy()
  | :invalid
  | :dc_ip
  | :site_ip_blocklist
@type t() :: %Plausible.Ingestion.Event{
  changeset: %Ecto.Changeset{
    action: term(),
    changes: term(),
    constraints: term(),
    data: term(),
    empty_values: term(),
    errors: term(),
    filters: term(),
    params: term(),
    prepare: term(),
    repo: term(),
    repo_opts: term(),
    required: term(),
    types: term(),
    valid?: term(),
    validations: term()
  },
  clickhouse_event:
    %Plausible.ClickhouseEventV2{
      __meta__: term(),
      browser: term(),
      browser_version: term(),
      city_geoname_id: term(),
      country_code: term(),
      hostname: term(),
      "meta.key": term(),
      "meta.value": term(),
      name: term(),
      operating_system: term(),
      operating_system_version: term(),
      pathname: term(),
      referrer: term(),
      referrer_source: term(),
      revenue_reporting_amount: term(),
      revenue_reporting_currency: term(),
      revenue_source_amount: term(),
      revenue_source_currency: term(),
      screen_size: term(),
      session_id: term(),
      site_id: term(),
      subdivision1_code: term(),
      subdivision2_code: term(),
      timestamp: term(),
      transferred_from: term(),
      user_id: term(),
      utm_campaign: term(),
      utm_content: term(),
      utm_medium: term(),
      utm_source: term(),
      utm_term: term()
    }
    | nil,
  clickhouse_event_attrs: map(),
  domain: String.t() | nil,
  drop_reason: drop_reason(),
  dropped?: boolean(),
  request: Plausible.Ingestion.Request.t(),
  salts: map(),
  site:
    %Plausible.Site{
      __meta__: term(),
      allowed_event_props: term(),
      conversions_enabled: term(),
      domain: term(),
      domain_changed_at: term(),
      domain_changed_from: term(),
      entry_type: term(),
      from_cache?: term(),
      funnels_enabled: term(),
      goals: term(),
      google_auth: term(),
      id: term(),
      imported_data: term(),
      ingest_rate_limit_scale_seconds: term(),
      ingest_rate_limit_threshold: term(),
      inserted_at: term(),
      invitations: term(),
      locked: term(),
      members: term(),
      memberships: term(),
      monthly_report: term(),
      native_stats_start_at: term(),
      owner: term(),
      ownership: term(),
      pinned_at: term(),
      props_enabled: term(),
      public: term(),
      revenue_goals: term(),
      spike_notification: term(),
      stats_start_date: term(),
      timezone: term(),
      updated_at: term(),
      weekly_report: term()
    }
    | nil
}

Functions

Link to this function

build_and_buffer(request)

View Source
@spec build_and_buffer(Plausible.Ingestion.Request.t()) ::
  {:ok, %{buffered: [t()], dropped: [t()]}}
Link to this function

emit_telemetry_buffered(event)

View Source
@spec emit_telemetry_buffered(t()) :: :ok
Link to this function

emit_telemetry_dropped(event, reason)

View Source
@spec emit_telemetry_dropped(t(), drop_reason()) :: :ok
Link to this function

telemetry_event_buffered()

View Source
@spec telemetry_event_buffered() :: [atom()]
Link to this function

telemetry_event_dropped()

View Source
@spec telemetry_event_dropped() :: [atom()]