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

api_endpoint=os.environ['API_GATEWAY_ENDPOINT']
datacoral_env=os.environ['DATACORAL_ENV']
api_key=os.environ['DATACORAL_API_KEY']
namespace=os.environ['NAMESPACE'] or 'mynamespace'
app_id=os.environ['APP_ID'] or 'datacoral-python-tracker'

# Initialize the emitter
emitter = Emitter(api_endpoint, buffer_size=1)

# Initialize the tracker
tracker = Tracker(
    emitter,
    datacoral_env=datacoral_env,
    api_key=api_key,
    namespace=namespace,
    app_id=app_id,
    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.12.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

datacoral_tracker_py-0.0.12-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file datacoral-tracker-py-0.0.12.tar.gz.

File metadata

  • Download URL: datacoral-tracker-py-0.0.12.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.4

File hashes

Hashes for datacoral-tracker-py-0.0.12.tar.gz
Algorithm Hash digest
SHA256 77dc88a8ef2f70e388b6c6fe9801548a6572b1b37c54cf2373078925077515b2
MD5 326ed68b2b1e559587447e8a412abb3a
BLAKE2b-256 e72380bc8e64e1f6ee37c40ea0fa6ebf95e0b4f49b49d3c5965aabecd6a5805c

See more details on using hashes here.

File details

Details for the file datacoral_tracker_py-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: datacoral_tracker_py-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.4

File hashes

Hashes for datacoral_tracker_py-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 516cf2a923daaf880a8db8078f401413e1c5bae341602e320da620f13bec8922
MD5 45badaf208ee1ae9fa67f4815cc30d48
BLAKE2b-256 c6c6a0d190ca2624bd40da3b3bb84da2d384aa54b534245b0313a4d6dee75294

See more details on using hashes here.

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