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.openanalytics import OpenAnalytics
client = OpenAnalytics(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(uri="mongodb://localhost:27017/", db="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.identify(
    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.3.tar.gz (14.7 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.3-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open_analytics-0.1.3.tar.gz
  • Upload date:
  • Size: 14.7 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.3.tar.gz
Algorithm Hash digest
SHA256 4b1793bbf7e6385154630a2757daeb0bbe80f1bd01edf376f0a2579483640d3d
MD5 4a3325b90c8e5a220624d321b5bca6b4
BLAKE2b-256 758469b936c173a477a46f1f047ebe04a91ac1e560c1592e3272d78f757af12e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: open_analytics-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9156c2d503d1f6e23ea56f9542c22b64b8fa6db23c84e060a6312ea8430c9778
MD5 1a45e5659521d6e640e06755eebe997d
BLAKE2b-256 bd9383731c4990908126866764850d16e8ee3e15fe1a1f7129b2523973ff5c35

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