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.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.2.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.2-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open_analytics-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 ca173b3a87ab2ee145a374412b910c079b89981a006e195b667a3a0c3d61d77b
MD5 2f1155929631d85daf3956c7c6aabcee
BLAKE2b-256 8e626f4fae73b25b48815dfe6fbd271d800f79b194c1945903fab54208f22fe1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: open_analytics-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b29b4c969e5d21e76cb50a78fbc1473b944ffc1c3612cc095aa5852b6388d134
MD5 5cd29f5462e34ef9cb5408462fb9be6b
BLAKE2b-256 fe3f25771d928a31f25a82791aea1d054b6f53b70cf96892c99fb87707959704

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