Vnstock Analytics Interface
Project description
VNAI
System resource management and performance optimization toolkit.
Installation
pip install vnai
Usage
from vnai import beam, flow, scope
# Your code here
Analytics & Telemetry Pipeline
Module: vnai/flow/relay.py
This module is responsible for collecting, buffering, and securely transmitting system analytics and telemetry data for VNAI.
Key Features & Logic
-
Singleton Class:
Conduit- Ensures only one analytics pipeline runs per process.
- Buffers analytics events (function calls, API requests, rate limits) in memory.
-
Data Buffering
- Data is grouped into three categories:
function_calls,api_requests,rate_limits. - Buffer size and sync interval are configurable (default: 50 events or 5 minutes).
- Periodic and event-driven dispatch logic ensures timely delivery without overloading the endpoint.
- Data is grouped into three categories:
-
Segment Detection
- Each payload includes a top-level key
segmentto distinguish betweenfreeandpaidusers. - The segment is determined by the license status (
ContentManager().is_paid_user).
- Each payload includes a top-level key
-
Endpoint & Headers
- All analytics data is POSTed to:
https://hq.vnstocks.com/analytics - Requires HTTP header:
x-api-key: 1yI8KgarntQr0ptriseHhb4kdomkenyNI8VPiyk5aoU - Content-Type is always
application/json.
- All analytics data is POSTed to:
-
Payload Structure
- Example:
{ "segment": "free", // or "paid" "analytics_data": { ... }, "metadata": { ... } }
analytics_datacontains buffered events;metadataincludes timestamp, machine_id, trigger reason, and environment info.
- Example:
-
Retry & Failure Handling
- If a POST fails, the payload is queued in
failed_queue(max 10 entries). - Retries are attempted on subsequent dispatches.
- If a POST fails, the payload is queued in
-
Configuration
- Use
from vnai.flow.relay import configureto (re)configure the endpoint if needed (default is always hq.vnstocks.com/analytics).
- Use
-
Usage Example
from vnai.flow import relay relay.track_function_call('my_func', 'user', 0.05) relay.sync_now() # Manually trigger immediate send
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vnai-2.2.1.tar.gz.
File metadata
- Download URL: vnai-2.2.1.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b56b6d2c89ce4869043715d4638268fc5631da799f15b267fd90c220cdd83a9
|
|
| MD5 |
306f62c542f19b5e33a629890e3136b7
|
|
| BLAKE2b-256 |
d317e0debef226324164a4e87478ce3f64c7214675957278bef7685308807578
|
File details
Details for the file vnai-2.2.1-py3-none-any.whl.
File metadata
- Download URL: vnai-2.2.1-py3-none-any.whl
- Upload date:
- Size: 42.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bca309bd12eef1ab95f4a58a25487751cb1e005ff6d9f0965ba0e884db8dc09f
|
|
| MD5 |
9a2c3c9f71046617c1bf1db31c3145e0
|
|
| BLAKE2b-256 |
7c7d20527b90ecf90decba84a1d83d8b886a92968b17c9858222777ee33793de
|