Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize timestamp before plugins, clean up PluginEvent #6871

Closed
mariusandra opened this issue May 23, 2021 · 2 comments
Closed

Sanitize timestamp before plugins, clean up PluginEvent #6871

mariusandra opened this issue May 23, 2021 · 2 comments

Comments

@mariusandra
Copy link
Collaborator

The PluginEvent object used by plugins for passing data has this structure:

export interface PluginEvent {
    distinct_id: string
    ip: string | null
    site_url: string
    team_id: number
    now: string
    event: string
    sent_at?: string
    properties?: Properties
    timestamp?: string
    offset?: number
    /** Person properties update (override). */
    $set?: Properties
    /** Person properties update (if not set). */
    $set_once?: Properties
    /** The offset of the Kafka message this event was passed in (EE pipeline-only). */
    kafka_offset?: string
    /** The assigned UUIDT of the event (EE pipeline-only). */
    uuid?: string
}

The field timestamp seems to be the key temporal value for plugin event data. However when plugins run on an event, this value is undefined. Only later, in processEvent do we parse the timestamp and use it to store the event.

This has some implications. For example the BigQuery Export Plugin needs to manually do timestamp || now || sent_at. That's too much for a plugin to know. Same with many other plugins. I ran into this myself with the session tracker plugin and was surprised to find this timestamp to be completely empty.

Thus I propose that the PluginEvent we send to plugins is the most sanitized version available. This means possibly even removing or blanking the now, sent_at, offset fields.

This also means removing $set (and $set_once and maybe $increment?) from properties and putting it in the core of the event.

@Twixes Twixes self-assigned this Jun 3, 2021
@Twixes Twixes removed their assignment Jun 18, 2021
@tiina303 tiina303 transferred this issue from PostHog/plugin-server Nov 3, 2021
@posthog-bot
Copy link
Contributor

This issue hasn't seen activity in two years! If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in two weeks.

@posthog-bot
Copy link
Contributor

This issue was closed due to lack of activity. Feel free to reopen if it's still relevant.

@posthog-bot posthog-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
@github-project-automation github-project-automation bot moved this to Done This Sprint in Extensibility Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done This Sprint
Development

No branches or pull requests

4 participants