Ejemplo n.º 1
0
def track(type, data):
    """
    Called for the tracking of events
    input: type of event to track, data to pass
    output: No return
    """
    emitter = Emitter(SNOWPLOW_MICRO_URI,
                      buffer_size=1,
                      on_success=success,
                      on_failure=failure)
    tracker = Tracker(emitter)
    # Dictionary to contain all events we want to track and their corresponding methods.
    # So we can have a more generic way to track
    dict = {
        PAGE_VIEW: tracker.track_page_view,
        FORM_SUBMIT: tracker.track_form_submit,
        STRUCT: tracker.track_struct_event
    }
    subject = Subject()
    subject.set_platform("pc")
    tracker.set_subject(subject)
    if isinstance(data, list):
        dict[type](*data)
    else:
        dict[type](data)
    logger.setLevel(10)
Ejemplo n.º 2
0
from dbt.logger import GLOBAL_LOGGER as logger
from dbt import version as dbt_version
from snowplow_tracker import Subject, Tracker, Emitter, logger as sp_logger
from snowplow_tracker import SelfDescribingJson
from datetime import datetime

import logbook
import pytz
import platform
import uuid
import requests
import yaml
import os

sp_logger.setLevel(100)

COLLECTOR_URL = "fishtownanalytics.sinter-collect.com"
COLLECTOR_PROTOCOL = "https"

INVOCATION_SPEC = 'iglu:com.dbt/invocation/jsonschema/1-0-1'
PLATFORM_SPEC = 'iglu:com.dbt/platform/jsonschema/1-0-0'
RUN_MODEL_SPEC = 'iglu:com.dbt/run_model/jsonschema/1-0-1'
INVOCATION_ENV_SPEC = 'iglu:com.dbt/invocation_env/jsonschema/1-0-0'
PACKAGE_INSTALL_SPEC = 'iglu:com.dbt/package_install/jsonschema/1-0-0'
RPC_REQUEST_SPEC = 'iglu:com.dbt/rpc_request/jsonschema/1-0-1'

DBT_INVOCATION_ENV = 'DBT_INVOCATION_ENV'


class TimeoutEmitter(Emitter):
    def __init__(self):
Ejemplo n.º 3
0
from dbt.logger import GLOBAL_LOGGER as logger
from dbt import version as dbt_version
from snowplow_tracker import Subject, Tracker, Emitter, logger as sp_logger
from snowplow_tracker import SelfDescribingJson
from datetime import datetime

import pytz
import platform
import uuid
import yaml
import os

import dbt.clients.system

sp_logger.setLevel(100)

COLLECTOR_URL = "fishtownanalytics.sinter-collect.com"
COLLECTOR_PROTOCOL = "https"

INVOCATION_SPEC = 'iglu:com.dbt/invocation/jsonschema/1-0-0'
PLATFORM_SPEC = 'iglu:com.dbt/platform/jsonschema/1-0-0'
RUN_MODEL_SPEC = 'iglu:com.dbt/run_model/jsonschema/1-0-1'
INVOCATION_ENV_SPEC = 'iglu:com.dbt/invocation_env/jsonschema/1-0-0'
PACKAGE_INSTALL_SPEC = 'iglu:com.dbt/package_install/jsonschema/1-0-0'

DBT_INVOCATION_ENV = 'DBT_INVOCATION_ENV'

emitter = Emitter(COLLECTOR_URL, protocol=COLLECTOR_PROTOCOL, buffer_size=1)
tracker = Tracker(emitter, namespace="cf", app_id="dbt")

active_user = None