open-analytics


Nameopen-analytics JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryOpen sournce application analytics tracking library
upload_time2024-11-17 06:37:11
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseApache License v2.0
keywords analytics tracking tracing logging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

```sh
pip install open-analytics
```

## Initalize
```sh
from openanalytics.openanalytics import OpenAnalytics
```
```sh
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
```sh
from openanalytics.connectors.MongoDBConnector import MongoDBConnector
connector = MongoDBConnector(uri="mongodb://localhost:27017/", db="demobucket")
```

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

#### SQLiteConnector
```sh
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.
```sh
from openanalytics.models.Identify import Identify
```
```sh
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.
```sh
from openanalytics.models.Token import Token
```
```sh
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.
```sh
from openanalytics.models.Track import Track
```
```sh
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.
```sh
from openanalytics.models.Page import Page
```
```sh
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.
```sh
from openanalytics.models.Logger import Logger
```
```sh
client.logger(
    Log(
        summary="Log Message",
        level="Debug",
        event="Process Login Function",
        metadata={"user": "username"},
    )
)
```

## License

Apache License v2.0

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "open-analytics",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "analytics, tracking, tracing, logging",
    "author": null,
    "author_email": "Lakitha Samarasinghe <Lakitharav@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/75/84/69b936c173a477a46f1f047ebe04a91ac1e560c1592e3272d78f757af12e/open_analytics-0.1.3.tar.gz",
    "platform": null,
    "description": "# Open-Analytics\n## An open-source analytical data capturing pacakge.\n\nOpen-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.\n\n## Installation\n\nInstall the dependencies and devDependencies and start the server.\n\n```sh\npip install open-analytics\n```\n\n## Initalize\n```sh\nfrom openanalytics.openanalytics import OpenAnalytics\n```\n```sh\nclient = OpenAnalytics(connector=connector, sync_mode=False, debug=True)\n```\n\n## Connecting to data-source\nAs of now the open-analytics library provide Connector Plugins for three types of databases.\n\n#### MongoDBConnector\n```sh\nfrom openanalytics.connectors.MongoDBConnector import MongoDBConnector\nconnector = MongoDBConnector(uri=\"mongodb://localhost:27017/\", db=\"demobucket\")\n```\n\n#### InfluxDBConnector\n```sh\nfrom openanalytics.connectors.InfluxDBConnector import InfluxDBConnector\nconnector = InfluxDBConnector(\n    token=\"5wttcrwYX3COT8OQaorbOKUYAmPPNE-7oC_2itF60bBqIfC33L9g4k3APNjcCkCAuBuwWurOVEBo6gNYP0cAuA==\",\n    org=\"demoorg\",\n    url=\"http://localhost:8086\",\n    bucket=\"demobucket\",\n)\n```\n\n#### SQLiteConnector\n```sh\nfrom openanalytics.connectors.SQLiteConnector import SQLiteConnector\nconnector = SQLiteConnector(db=\"handshake.sqlite3\")\n```\n\n## Features\n\n### Identify\nThe 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.\n```sh\nfrom openanalytics.models.Identify import Identify\n```\n```sh\nclient.identify(\n    Identify(\n        userID=\"UserName / UserEmail\", \n        event=\"Custom Event\", \n        metadata={\"data\": \"query data\", \"location\": \"query location\"},\n        timestamp=datetime.now(timezone.utc),\n    )\n)\n```\n\n### Token\nUseful 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.\n```sh\nfrom openanalytics.models.Token import Token\n```\n```sh\nclient.token(\n    Token(\n        event=\"LLM Query Event\",\n        action=\"Similarity Search\",\n        count=134,\n        metadata={\n            \"query\": \"llm prompt\",\n            \"location\": {\"context\": \"context of the prompt\", \"rag\": \"enabled\"},\n        },\n    )\n)\n```\n\n### Track\nTrack lets you record the actions your users perform. Every action triggers what open-analytics calls an \u201cevent\u201d, which can also have associated properties.\n```sh\nfrom openanalytics.models.Track import Track\n```\n```sh\nclient.track(\n    Track(\n        endpoint=\"http:localhost:8080/search\",\n        event=\"Profile Search\",\n        properties={\"params\": \"q=username\"},\n        timestamp=datetime.now(timezone.utc),\n    )\n)\n```\n\n### Page\nThe Page method lets you record page views on your website, along with optional extra information about the page being viewed.\n```sh\nfrom openanalytics.models.Page import Page\n```\n```sh\nclient.page(\n    Page(\n        name=\"Dashboard\", \n        category=\"AdminGroup\", \n        properties={\"status\": True}\n    )\n)\n```\n\n### Logger\nThe Log method lets you record log events of your actions, along with optional extra information about the log event.\n```sh\nfrom openanalytics.models.Logger import Logger\n```\n```sh\nclient.logger(\n    Log(\n        summary=\"Log Message\",\n        level=\"Debug\",\n        event=\"Process Login Function\",\n        metadata={\"user\": \"username\"},\n    )\n)\n```\n\n## License\n\nApache License v2.0\n",
    "bugtrack_url": null,
    "license": "Apache License v2.0",
    "summary": "Open sournce application analytics tracking library",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/LakithaRav/open-analytics"
    },
    "split_keywords": [
        "analytics",
        " tracking",
        " tracing",
        " logging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd9383731c4990908126866764850d16e8ee3e15fe1a1f7129b2523973ff5c35",
                "md5": "1a45e5659521d6e640e06755eebe997d",
                "sha256": "9156c2d503d1f6e23ea56f9542c22b64b8fa6db23c84e060a6312ea8430c9778"
            },
            "downloads": -1,
            "filename": "open_analytics-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a45e5659521d6e640e06755eebe997d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 19554,
            "upload_time": "2024-11-17T06:37:08",
            "upload_time_iso_8601": "2024-11-17T06:37:08.673648Z",
            "url": "https://files.pythonhosted.org/packages/bd/93/83731c4990908126866764850d16e8ee3e15fe1a1f7129b2523973ff5c35/open_analytics-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "758469b936c173a477a46f1f047ebe04a91ac1e560c1592e3272d78f757af12e",
                "md5": "4a3325b90c8e5a220624d321b5bca6b4",
                "sha256": "4b1793bbf7e6385154630a2757daeb0bbe80f1bd01edf376f0a2579483640d3d"
            },
            "downloads": -1,
            "filename": "open_analytics-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4a3325b90c8e5a220624d321b5bca6b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14672,
            "upload_time": "2024-11-17T06:37:11",
            "upload_time_iso_8601": "2024-11-17T06:37:11.085617Z",
            "url": "https://files.pythonhosted.org/packages/75/84/69b936c173a477a46f1f047ebe04a91ac1e560c1592e3272d78f757af12e/open_analytics-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-17 06:37:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LakithaRav",
    "github_project": "open-analytics",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "open-analytics"
}
        
Elapsed time: 1.01039s