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
  | :site_country_blocklist
  | :site_page_blocklist
  | :site_hostname_allowlist
  | :verification_agent
  | :lock_timeout
  | :no_session_for_pageleave
@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(),
      acquisition_channel: term(),
      browser: term(),
      browser_version: term(),
      city_geoname_id: term(),
      click_id_param: 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(),
      scroll_depth: term(),
      session_id: term(),
      site_id: term(),
      subdivision1_code: term(),
      subdivision2_code: term(),
      timestamp: term(),
      user_id: term(),
      utm_campaign: term(),
      utm_content: term(),
      utm_medium: term(),
      utm_source: term(),
      utm_term: term()
    }
    | nil,
  clickhouse_event_attrs: map(),
  clickhouse_session_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(),
      complete_import_ids: term(),
      conversions_enabled: term(),
      domain: term(),
      domain_changed_at: term(),
      domain_changed_from: term(),
      earliest_import_start_date: term(),
      entry_type: term(),
      from_cache?: term(),
      funnels_enabled: term(),
      goals: term(),
      google_auth: term(),
      guest_invitations: term(),
      guest_memberships: term(),
      id: term(),
      import_data_loaded: term(),
      imported_data: term(),
      ingest_rate_limit_scale_seconds: term(),
      ingest_rate_limit_threshold: term(),
      inserted_at: term(),
      installation_meta: term(),
      invitations: term(),
      latest_import_end_date: 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(),
      stats_start_date: term(),
      team: term(),
      team_id: term(),
      timezone: term(),
      updated_at: term(),
      weekly_report: term()
    }
    | nil
}

Functions

Link to this function

build_and_buffer(request, context \\ [])

View Source
@spec build_and_buffer(Plausible.Ingestion.Request.t(), Keyword.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()]
Link to this function

telemetry_pipeline_step_duration()

View Source