Skip to main content

Datacoral's Python Instrumentation using Snowplow

Project description

Datacoral's Python Instrumentation using Snowplow

Prerequisits

This section of the documentation is useful if you have the Datacoral Events Connector already added to your Datacoral Installation.
Contact support@datacoral.co today, in oredr to set up your new Events Connector.

Overview

Our default Collect Events Slice is compatible with the Snowplow Tracker Protocol.

Snowplow provides tracker or instrumentation libraries in several languages.
We have incorporated those libraries and enhanced them to support:

  1. Pointing to your own Events HTTP Endpoint.
  2. Generate API Keys
  3. Create multiple environments like dev/stage/prod so that events can be segregated based on the environment.
  4. A browser js instrumentation, specifying CORS Origins

Contributing quickstart

Assuming Git and Datacoral CLI are installed:

Installing datacoral-tracker-py

pip install datacoral-tracker-py

Publishing (Tracking)

from snowplow_tracker import SelfDescribingJson, Tracker, Emitter

# Initialize the emitter
emitter = Emitter("your-api-gatewat-FQDN-here", buffer_size=1)

# Initialize the tracker
tracker = Tracker(
    emitter,
    datacoral_env="dev",
    api_key=["your-api-key-here"],
    namespace="your-namespace-here",
    app_id="app-id-here",
    encode_base64=True
)

# Send a custom event with your own schema and contexts
data = {
    "foo": "bar",
    "metadata": {
        "sub": "data"
    }
}

sjson = SelfDescribingJson(
    schema="test",
    data=data)

tracker.track_unstruct_event(
    event_json=sjson)

Additional Reading

Copyright and license

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datacoral-tracker-py-0.0.9.tar.gz (14.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page