Skip to main content

Open sournce application analytics tracking library

Project description

Open-Analytics

An open-source analytical data capturing pacakge.

Open-Analytics lib enables you to capture and track analyitical data of your application at real-time into your own data-source. You can use your own or open-source tools to visualize the capture data.

Installation

Install the dependencies and devDependencies and start the server.

pip install open-analytics

Initalize

from openanalytics.client import Client
client = Client(connector=connector, sync_mode=False, debug=True)

Connecting to data-source

As of now the open-analytics library provide Connector Plugins for three types of databases.

MongoDBConnector

from openanalytics.connectors.MongoDBConnector import MongoDBConnector
connector = MongoDBConnector(host="mongodb://localhost:27017/", dbname="demobucket")

InfluxDBConnector

from openanalytics.connectors.InfluxDBConnector import InfluxDBConnector
connector = InfluxDBConnector(
    token="5wttcrwYX3COT8OQaorbOKUYAmPPNE-7oC_2itF60bBqIfC33L9g4k3APNjcCkCAuBuwWurOVEBo6gNYP0cAuA==",
    org="demoorg",
    url="http://localhost:8086",
    bucket="demobucket",
)

SQLiteConnector

from openanalytics.connectors.SQLiteConnector import SQLiteConnector
connector = SQLiteConnector(db="handshake.sqlite3")

Features

Identify

The Identify method lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about them.

from openanalytics.models.Identify import Identify
client.idetify(
    Identify(
        userID="UserName / UserEmail", 
        event="Custom Event", 
        metadata={"data": "query data", "location": "query location"},
        timestamp=datetime.now(timezone.utc),
    )
)

Token

Useful in Generative AI token processing. The Token method lets you record token utlization for you events, along with optional extra information about the token processing.

from openanalytics.models.Token import Token
client.token(
    Token(
        event="LLM Query Event",
        action="Similarity Search",
        count=134,
        metadata={
            "query": "llm prompt",
            "location": {"context": "context of the prompt", "rag": "enabled"},
        },
    )
)

Track

Track lets you record the actions your users perform. Every action triggers what open-analytics calls an “event”, which can also have associated properties.

from openanalytics.models.Track import Track
client.track(
    Track(
        endpoint="http:localhost:8080/search",
        event="Profile Search",
        properties={"params": "q=username"},
        timestamp=datetime.now(timezone.utc),
    )
)

Page

The Page method lets you record page views on your website, along with optional extra information about the page being viewed.

from openanalytics.models.Page import Page
client.page(
    Page(
        name="Dashboard", 
        category="AdminGroup", 
        properties={"status": True}
    )
)

Logger

The Log method lets you record log events of your actions, along with optional extra information about the log event.

from openanalytics.models.Logger import Logger
client.logger(
    Log(
        summary="Log Message",
        level="Debug",
        event="Process Login Function",
        metadata={"user": "username"},
    )
)

License

Apache License v2.0

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

open_analytics-0.1.1.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

open_analytics-0.1.1-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file open_analytics-0.1.1.tar.gz.

File metadata

  • Download URL: open_analytics-0.1.1.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for open_analytics-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e3bf16883fa6144a9a34c403cb93b39e321c24a8e02f280e15a31a5b1dc0e930
MD5 dca91038659931924c60d99510c4a61b
BLAKE2b-256 384c4588a4471f1e0ba5904a3373832a1bf8c1e842a43c55fe346d38f3fc749c

See more details on using hashes here.

File details

Details for the file open_analytics-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: open_analytics-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for open_analytics-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e12dd9728d7d9c17833f8787874575a77886c27e4643acbf0ce1ef44485f1cca
MD5 83581603c63e293bdb5ba7ee97f494b9
BLAKE2b-256 60edc699f830d7eb18b5db52c5bc14b04d04aecef9d1888cb0a8c3029d7cf3f7

See more details on using hashes here.

Supported by

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