sketchlog 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sketchlog-1.2.1/CHANGELOG.md +59 -0
- sketchlog-1.2.1/CMakeLists.txt +43 -0
- sketchlog-1.2.1/LICENSE +21 -0
- sketchlog-1.2.1/MANIFEST.in +12 -0
- sketchlog-1.2.1/PKG-INFO +206 -0
- sketchlog-1.2.1/README.md +143 -0
- sketchlog-1.2.1/SECURITY.md +38 -0
- sketchlog-1.2.1/build_wasm.ps1 +27 -0
- sketchlog-1.2.1/build_wasm.sh +21 -0
- sketchlog-1.2.1/cpp/bindings.cpp +420 -0
- sketchlog-1.2.1/docs/guarantees.md +297 -0
- sketchlog-1.2.1/include/countmin.hpp +281 -0
- sketchlog-1.2.1/include/ddsketch.hpp +590 -0
- sketchlog-1.2.1/include/hyperloglog.hpp +261 -0
- sketchlog-1.2.1/include/sketchlog.hpp +322 -0
- sketchlog-1.2.1/pyproject.toml +100 -0
- sketchlog-1.2.1/python/sketchlog/__init__.py +71 -0
- sketchlog-1.2.1/python/sketchlog/_atomic.py +104 -0
- sketchlog-1.2.1/python/sketchlog/alerts.py +303 -0
- sketchlog-1.2.1/python/sketchlog/cluster.py +915 -0
- sketchlog-1.2.1/python/sketchlog/concurrent.py +155 -0
- sketchlog-1.2.1/python/sketchlog/core/__init__.py +0 -0
- sketchlog-1.2.1/python/sketchlog/core/cms.py +104 -0
- sketchlog-1.2.1/python/sketchlog/core/ddsketch.py +254 -0
- sketchlog-1.2.1/python/sketchlog/core/hll.py +92 -0
- sketchlog-1.2.1/python/sketchlog/core/stats.py +12 -0
- sketchlog-1.2.1/python/sketchlog/diff.py +182 -0
- sketchlog-1.2.1/python/sketchlog/drift.py +444 -0
- sketchlog-1.2.1/python/sketchlog/ebpf/__init__.py +3 -0
- sketchlog-1.2.1/python/sketchlog/ebpf/bpf_code.c +93 -0
- sketchlog-1.2.1/python/sketchlog/ebpf/collector.py +260 -0
- sketchlog-1.2.1/python/sketchlog/facade.py +792 -0
- sketchlog-1.2.1/python/sketchlog/integrations/__init__.py +1 -0
- sketchlog-1.2.1/python/sketchlog/integrations/fastapi.py +66 -0
- sketchlog-1.2.1/python/sketchlog/integrations/opentelemetry.py +183 -0
- sketchlog-1.2.1/python/sketchlog/integrations/prometheus.py +100 -0
- sketchlog-1.2.1/python/sketchlog/py.typed +1 -0
- sketchlog-1.2.1/python/sketchlog/server.py +1241 -0
- sketchlog-1.2.1/python/sketchlog/slo.py +92 -0
- sketchlog-1.2.1/python/sketchlog/sql.py +406 -0
- sketchlog-1.2.1/python/sketchlog/storage.py +258 -0
- sketchlog-1.2.1/python/sketchlog/windowed.py +231 -0
- sketchlog-1.2.1/python/sketchlog.egg-info/PKG-INFO +206 -0
- sketchlog-1.2.1/python/sketchlog.egg-info/SOURCES.txt +82 -0
- sketchlog-1.2.1/python/sketchlog.egg-info/dependency_links.txt +1 -0
- sketchlog-1.2.1/python/sketchlog.egg-info/entry_points.txt +3 -0
- sketchlog-1.2.1/python/sketchlog.egg-info/requires.txt +41 -0
- sketchlog-1.2.1/python/sketchlog.egg-info/top_level.txt +2 -0
- sketchlog-1.2.1/setup.cfg +4 -0
- sketchlog-1.2.1/setup.py +27 -0
- sketchlog-1.2.1/tests/test_advanced.py +199 -0
- sketchlog-1.2.1/tests/test_alerts.py +132 -0
- sketchlog-1.2.1/tests/test_clustering.py +162 -0
- sketchlog-1.2.1/tests/test_compatibility.py +18 -0
- sketchlog-1.2.1/tests/test_diff.py +63 -0
- sketchlog-1.2.1/tests/test_drift.py +269 -0
- sketchlog-1.2.1/tests/test_ebpf.py +113 -0
- sketchlog-1.2.1/tests/test_failure_injection.py +165 -0
- sketchlog-1.2.1/tests/test_fastapi.py +72 -0
- sketchlog-1.2.1/tests/test_feature_contracts.py +99 -0
- sketchlog-1.2.1/tests/test_features.py +518 -0
- sketchlog-1.2.1/tests/test_hardening.py +597 -0
- sketchlog-1.2.1/tests/test_integration.py +75 -0
- sketchlog-1.2.1/tests/test_lifecycle.py +192 -0
- sketchlog-1.2.1/tests/test_load.py +151 -0
- sketchlog-1.2.1/tests/test_mesh.py +306 -0
- sketchlog-1.2.1/tests/test_namespaces.py +95 -0
- sketchlog-1.2.1/tests/test_observability.py +65 -0
- sketchlog-1.2.1/tests/test_opentelemetry.py +135 -0
- sketchlog-1.2.1/tests/test_overload.py +133 -0
- sketchlog-1.2.1/tests/test_production.py +139 -0
- sketchlog-1.2.1/tests/test_prometheus.py +35 -0
- sketchlog-1.2.1/tests/test_properties.py +266 -0
- sketchlog-1.2.1/tests/test_server.py +281 -0
- sketchlog-1.2.1/tests/test_sketchlog.py +188 -0
- sketchlog-1.2.1/tests/test_slo.py +59 -0
- sketchlog-1.2.1/tests/test_soak.py +188 -0
- sketchlog-1.2.1/tests/test_sql.py +110 -0
- sketchlog-1.2.1/tests/test_storage.py +117 -0
- sketchlog-1.2.1/tests/test_stress.py +191 -0
- sketchlog-1.2.1/tests/test_windowed.py +74 -0
- sketchlog-1.2.1/tests/test_windowed_deterministic.py +86 -0
- sketchlog-1.2.1/wasm/bindings.cpp +152 -0
- sketchlog-1.2.1/wasm/sketchlog.js +159 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Prevent Windows checkpoint writers from being starved by concurrent same-path
|
|
8
|
+
readers, while retaining bounded retries for readers in other processes.
|
|
9
|
+
|
|
10
|
+
## 1.2.0
|
|
11
|
+
|
|
12
|
+
Python 3.10–3.14 are supported. Python 3.9 reached upstream end of life and is
|
|
13
|
+
no longer an install target.
|
|
14
|
+
|
|
15
|
+
### Security
|
|
16
|
+
|
|
17
|
+
- Canonically validate all serialized state before native allocation.
|
|
18
|
+
- Restrict mesh peers to canonical allowlisted origins, disable redirects, cap
|
|
19
|
+
membership, and require a cluster secret.
|
|
20
|
+
- Add namespace-scoped HTTP, SQL, aggregate, delete, and WebSocket authorization.
|
|
21
|
+
- Persist and gossip versioned deletion tombstones to prevent stale resurrection.
|
|
22
|
+
- Bound authenticated mesh requests and responses, split oversized anti-entropy
|
|
23
|
+
exchanges into progressive chunks, and reject malformed/non-finite peer state.
|
|
24
|
+
- Cap durable local tombstones and atomically commit SQL state deletion with its
|
|
25
|
+
tombstone so capacity or storage failure cannot create an unsafe delete.
|
|
26
|
+
- Scan containers before publication and sign image and Helm digests.
|
|
27
|
+
|
|
28
|
+
### Correctness and durability
|
|
29
|
+
|
|
30
|
+
- Replace unbounded DDSketch dense spans with bounded sparse stores.
|
|
31
|
+
- Make native batch ingestion transactional and correct for strided NumPy views.
|
|
32
|
+
- Align integer event keys and cross-backend merges.
|
|
33
|
+
- Use conservative threshold counts for SLO alert safety.
|
|
34
|
+
- Make file checkpoints flush/fsync/atomically replace and tolerate Windows
|
|
35
|
+
reader-sharing windows.
|
|
36
|
+
- Bound storage locks and make eviction wait for durable persistence.
|
|
37
|
+
- Bound checkpoint and database decompression, reject trailing/truncated state,
|
|
38
|
+
and retain the prior checkpoint when a replacement exceeds the state limit.
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
- Add executable anomaly comparison, SLO recommendation, sketch diffing, live
|
|
43
|
+
Streaming SQL, and precision-safe WASM merge contracts.
|
|
44
|
+
- Publishable TypeScript, React, WASM, and in-repository Go modules.
|
|
45
|
+
- Authenticated SDKs with credential providers, redirect and response-size
|
|
46
|
+
defenses, sanitized errors, close methods, and real transport retry tests.
|
|
47
|
+
- Runnable Linux/BCC collector with merge export and health/readiness endpoints.
|
|
48
|
+
- StatefulSet-based Helm mesh mode and an `autoscaling/v2` HPA.
|
|
49
|
+
|
|
50
|
+
### Quality and operations
|
|
51
|
+
|
|
52
|
+
- Generate and verify the OpenAPI contract.
|
|
53
|
+
- Serialize WebSocket 64-bit counters without JavaScript precision loss and
|
|
54
|
+
drive dashboard cardinality from the HyperLogLog estimate.
|
|
55
|
+
- Add web lint/build/component gates, branch coverage and critical subsystem
|
|
56
|
+
floors, fail-closed benchmark gates, Helm variants, WASM Node/browser smoke
|
|
57
|
+
tests, immutable Action pins, SBOM/provenance, and public-registry smoke tests.
|
|
58
|
+
- Synchronize version 1.2.0 across all coupled artifacts and rewrite operations
|
|
59
|
+
and feature documentation to match executable behavior.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.14)
|
|
2
|
+
project(SketchLog CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
|
|
7
|
+
if(MSVC)
|
|
8
|
+
set(CXX_WARNINGS /W4 /EHsc)
|
|
9
|
+
else()
|
|
10
|
+
set(CXX_WARNINGS -Wall -Wextra)
|
|
11
|
+
endif()
|
|
12
|
+
|
|
13
|
+
# Unified sketchlog library (header-only)
|
|
14
|
+
add_library(sketchlog INTERFACE)
|
|
15
|
+
target_include_directories(sketchlog INTERFACE include)
|
|
16
|
+
|
|
17
|
+
# Scale benchmark
|
|
18
|
+
add_executable(benchmark_scale benchmarks/benchmark_scale.cpp)
|
|
19
|
+
target_link_libraries(benchmark_scale PRIVATE sketchlog)
|
|
20
|
+
target_include_directories(benchmark_scale PRIVATE include)
|
|
21
|
+
target_compile_options(benchmark_scale PRIVATE ${CXX_WARNINGS})
|
|
22
|
+
|
|
23
|
+
# Tests
|
|
24
|
+
enable_testing()
|
|
25
|
+
add_executable(tests_cpp tests/test_cpp.cpp)
|
|
26
|
+
target_link_libraries(tests_cpp PRIVATE sketchlog)
|
|
27
|
+
target_include_directories(tests_cpp PRIVATE include)
|
|
28
|
+
target_compile_options(tests_cpp PRIVATE ${CXX_WARNINGS})
|
|
29
|
+
add_test(NAME cpp_tests COMMAND tests_cpp)
|
|
30
|
+
|
|
31
|
+
# Fuzzing
|
|
32
|
+
option(ENABLE_FUZZING "Build fuzz targets" OFF)
|
|
33
|
+
if(ENABLE_FUZZING)
|
|
34
|
+
if(NOT MSVC)
|
|
35
|
+
add_executable(fuzz_cpp tests/fuzz_cpp.cpp)
|
|
36
|
+
target_link_libraries(fuzz_cpp PRIVATE sketchlog)
|
|
37
|
+
target_include_directories(fuzz_cpp PRIVATE include)
|
|
38
|
+
target_compile_options(fuzz_cpp PRIVATE ${CXX_WARNINGS} -fsanitize=fuzzer)
|
|
39
|
+
target_link_options(fuzz_cpp PRIVATE -fsanitize=fuzzer)
|
|
40
|
+
else()
|
|
41
|
+
message(WARNING "Fuzzing is not supported on MSVC without explicit Clang integration.")
|
|
42
|
+
endif()
|
|
43
|
+
endif()
|
sketchlog-1.2.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sketchlog contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include SECURITY.md
|
|
5
|
+
include docs/guarantees.md
|
|
6
|
+
recursive-include python/sketchlog *.py
|
|
7
|
+
include CMakeLists.txt
|
|
8
|
+
recursive-include cpp *.cpp
|
|
9
|
+
recursive-include include *.hpp
|
|
10
|
+
include wasm/bindings.cpp
|
|
11
|
+
include wasm/sketchlog.js
|
|
12
|
+
include build_wasm.*
|
sketchlog-1.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sketchlog
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: Bounded-memory streaming metrics with DDSketch, HyperLogLog, and Count-Min Sketch.
|
|
5
|
+
Author: Bala Vignesh S
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/SBALAVIGNESH123/sketchlog
|
|
8
|
+
Project-URL: Repository, https://github.com/SBALAVIGNESH123/sketchlog
|
|
9
|
+
Project-URL: Issues, https://github.com/SBALAVIGNESH123/sketchlog/issues
|
|
10
|
+
Keywords: streaming,metrics,ddsketch,hyperloglog,count-min-sketch,percentile,p99,monitoring
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: System :: Monitoring
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: docs
|
|
27
|
+
Requires-Dist: mkdocs<2,>=1.6; extra == "docs"
|
|
28
|
+
Requires-Dist: mkdocs-material<10,>=9.5.0; extra == "docs"
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest; extra == "test"
|
|
31
|
+
Requires-Dist: pytest-asyncio; extra == "test"
|
|
32
|
+
Requires-Dist: numpy; extra == "test"
|
|
33
|
+
Requires-Dist: httpx; extra == "test"
|
|
34
|
+
Requires-Dist: hypothesis; extra == "test"
|
|
35
|
+
Requires-Dist: greenlet; extra == "test"
|
|
36
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
40
|
+
Requires-Dist: numpy; extra == "dev"
|
|
41
|
+
Requires-Dist: mkdocs<2,>=1.6; extra == "dev"
|
|
42
|
+
Requires-Dist: mkdocs-material<10,>=9.5.0; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy; extra == "dev"
|
|
44
|
+
Requires-Dist: pyright; extra == "dev"
|
|
45
|
+
Requires-Dist: httpx; extra == "dev"
|
|
46
|
+
Requires-Dist: hypothesis; extra == "dev"
|
|
47
|
+
Requires-Dist: types-psutil; extra == "dev"
|
|
48
|
+
Provides-Extra: opentelemetry
|
|
49
|
+
Requires-Dist: opentelemetry-api; extra == "opentelemetry"
|
|
50
|
+
Requires-Dist: opentelemetry-sdk; extra == "opentelemetry"
|
|
51
|
+
Requires-Dist: opentelemetry-exporter-otlp; extra == "opentelemetry"
|
|
52
|
+
Provides-Extra: server
|
|
53
|
+
Requires-Dist: fastapi<1,>=0.100.0; extra == "server"
|
|
54
|
+
Requires-Dist: uvicorn<1,>=0.20.0; extra == "server"
|
|
55
|
+
Requires-Dist: pydantic<3,>=2.0; extra == "server"
|
|
56
|
+
Requires-Dist: structlog>=23.1.0; extra == "server"
|
|
57
|
+
Requires-Dist: prometheus-client>=0.17.0; extra == "server"
|
|
58
|
+
Requires-Dist: asgi-correlation-id>=4.2.0; extra == "server"
|
|
59
|
+
Requires-Dist: psutil; extra == "server"
|
|
60
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.0.0; extra == "server"
|
|
61
|
+
Requires-Dist: aiosqlite; extra == "server"
|
|
62
|
+
Dynamic: license-file
|
|
63
|
+
|
|
64
|
+
# SketchLog
|
|
65
|
+
|
|
66
|
+

|
|
67
|
+

|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
**Bounded-memory streaming metrics with explicit approximation guarantees.**
|
|
71
|
+
|
|
72
|
+
SketchLog allows you to ingest high-throughput event streams and extract accurate
|
|
73
|
+
percentiles and cardinalities in constant memory. It combines **DDSketch** for latencies,
|
|
74
|
+
**HyperLogLog** for unique items, and **Count-Min Sketch** for event frequencies.
|
|
75
|
+
|
|
76
|
+
Instead of storing arrays of events or exporting raw telemetry, SketchLog compresses
|
|
77
|
+
the statistical shape of your data in real time, making it ideal for continuous
|
|
78
|
+
monitoring, edge devices, and memory-constrained environments.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 📚 Documentation
|
|
83
|
+
|
|
84
|
+
The full documentation is available at [SketchLog Documentation Site](https://sbalavignesh123.github.io/sketchlog/) (or via `/docs` in the repository).
|
|
85
|
+
It includes:
|
|
86
|
+
- **Architecture**: Details on distributed merges, drift detection, and memory footprint.
|
|
87
|
+
- **Benchmarks**: Memory footprint scaling and CPU throughput limits.
|
|
88
|
+
- **Guarantees**: Published error bounds, implementation preconditions, and
|
|
89
|
+
checked capacity limits.
|
|
90
|
+
- **Integrations**: How to integrate with Prometheus, FastAPI, and OpenTelemetry.
|
|
91
|
+
- **API Reference**: Core classes, methods, and persistence operations.
|
|
92
|
+
- **Contributing**: Guidelines for contributing to SketchLog.
|
|
93
|
+
|
|
94
|
+
### Local Documentation Build
|
|
95
|
+
To build and preview the documentation locally:
|
|
96
|
+
```bash
|
|
97
|
+
pip install ".[docs]"
|
|
98
|
+
mkdocs serve
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Installation
|
|
104
|
+
|
|
105
|
+
### 1. The Core Library (Python)
|
|
106
|
+
If you just want to use the high-performance sketching data structures directly in Python:
|
|
107
|
+
```bash
|
|
108
|
+
pip install sketchlog
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 2. The Standalone Server
|
|
112
|
+
To run SketchLog as an independent network service (like Redis or Prometheus):
|
|
113
|
+
```bash
|
|
114
|
+
pip install "sketchlog[server]"
|
|
115
|
+
uvicorn sketchlog.server:app --port 8080
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Quickstart
|
|
121
|
+
|
|
122
|
+
### 🐍 Python (Embedded Library)
|
|
123
|
+
```python
|
|
124
|
+
from sketchlog import StreamLog
|
|
125
|
+
|
|
126
|
+
log = StreamLog()
|
|
127
|
+
log.add_latency(42.5)
|
|
128
|
+
log.add_batch([15.0, 88.2, 42.1])
|
|
129
|
+
log.add_unique("user_12345")
|
|
130
|
+
log.add_event("cache_miss", count=5)
|
|
131
|
+
|
|
132
|
+
print(f"p99 Latency: {log.p99():.2f}ms")
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 🟨 TypeScript / Node.js SDK
|
|
136
|
+
Connect to the standalone server via HTTP:
|
|
137
|
+
```bash
|
|
138
|
+
npm install @sketchlog/client
|
|
139
|
+
```
|
|
140
|
+
```typescript
|
|
141
|
+
import { SketchLogClient } from '@sketchlog/client';
|
|
142
|
+
|
|
143
|
+
const client = new SketchLogClient({ endpoint: 'http://localhost:8080' });
|
|
144
|
+
|
|
145
|
+
// Validated HTTP ingestion with bounded retries
|
|
146
|
+
await client.ingestEvents('production_api', {
|
|
147
|
+
latencies: [42.5, 15.0, 88.2, 42.1],
|
|
148
|
+
uniques: ["user_12345"],
|
|
149
|
+
events: { "cache_miss": 5 }
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 🐹 Go SDK
|
|
154
|
+
```bash
|
|
155
|
+
go get github.com/SBALAVIGNESH123/sketchlog/clients/go@v1.2.1
|
|
156
|
+
```
|
|
157
|
+
```go
|
|
158
|
+
import "github.com/SBALAVIGNESH123/sketchlog/clients/go"
|
|
159
|
+
|
|
160
|
+
client := sketchlog.NewClient(sketchlog.ClientOptions{
|
|
161
|
+
Endpoint: "http://localhost:8080",
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
batch := sketchlog.EventBatch{
|
|
165
|
+
Latencies: []float64{42.5, 15.0, 88.2, 42.1},
|
|
166
|
+
Uniques: []string{"user_12345"},
|
|
167
|
+
Events: map[string]int64{"cache_miss": 5},
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
err := client.IngestEvents(ctx, "production_api", batch)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Distributed Clustering (Beta)
|
|
174
|
+
|
|
175
|
+
SketchLog supports multi-node clustering without requiring external coordination services like Redis.
|
|
176
|
+
|
|
177
|
+
You can run a cluster using the following environment variables:
|
|
178
|
+
```bash
|
|
179
|
+
SKETCHLOG_NODE_ID="node-1"
|
|
180
|
+
SKETCHLOG_PEERS="http://node2:8000,http://node3:8000"
|
|
181
|
+
SKETCHLOG_CLUSTER_SECRET="your-secret-token"
|
|
182
|
+
uvicorn sketchlog.server:app --port 8000
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
> **Performance trade-off**: Mesh mode currently uses deterministic Python
|
|
186
|
+
> sketches to guarantee identical merge state across heterogeneous nodes. Measure
|
|
187
|
+
> this mode with your own traffic before capacity planning.
|
|
188
|
+
|
|
189
|
+
## Community
|
|
190
|
+
|
|
191
|
+
Join us in Slack! [Join SketchLog Slack](https://join.slack.com/t/sketchlog/shared_invite/zt-41kc03dnl-tiyHm4Gr2CbaJWuGHxdbiQ)
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## What this is not
|
|
196
|
+
|
|
197
|
+
SketchLog is a streaming metrics compression layer. It is deliberately not:
|
|
198
|
+
|
|
199
|
+
- **Not a tracing system.** No request paths, no correlation IDs, no causal chains.
|
|
200
|
+
- **Not a time-series database.** No historical drill-down, no label indexing.
|
|
201
|
+
- **Not an observability platform.** No raw log storage, no ad-hoc queries.
|
|
202
|
+
- **Not exact.** All results are probabilistic with bounded error. If you need exact percentiles, use numpy.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
MIT License
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# SketchLog
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**Bounded-memory streaming metrics with explicit approximation guarantees.**
|
|
8
|
+
|
|
9
|
+
SketchLog allows you to ingest high-throughput event streams and extract accurate
|
|
10
|
+
percentiles and cardinalities in constant memory. It combines **DDSketch** for latencies,
|
|
11
|
+
**HyperLogLog** for unique items, and **Count-Min Sketch** for event frequencies.
|
|
12
|
+
|
|
13
|
+
Instead of storing arrays of events or exporting raw telemetry, SketchLog compresses
|
|
14
|
+
the statistical shape of your data in real time, making it ideal for continuous
|
|
15
|
+
monitoring, edge devices, and memory-constrained environments.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📚 Documentation
|
|
20
|
+
|
|
21
|
+
The full documentation is available at [SketchLog Documentation Site](https://sbalavignesh123.github.io/sketchlog/) (or via `/docs` in the repository).
|
|
22
|
+
It includes:
|
|
23
|
+
- **Architecture**: Details on distributed merges, drift detection, and memory footprint.
|
|
24
|
+
- **Benchmarks**: Memory footprint scaling and CPU throughput limits.
|
|
25
|
+
- **Guarantees**: Published error bounds, implementation preconditions, and
|
|
26
|
+
checked capacity limits.
|
|
27
|
+
- **Integrations**: How to integrate with Prometheus, FastAPI, and OpenTelemetry.
|
|
28
|
+
- **API Reference**: Core classes, methods, and persistence operations.
|
|
29
|
+
- **Contributing**: Guidelines for contributing to SketchLog.
|
|
30
|
+
|
|
31
|
+
### Local Documentation Build
|
|
32
|
+
To build and preview the documentation locally:
|
|
33
|
+
```bash
|
|
34
|
+
pip install ".[docs]"
|
|
35
|
+
mkdocs serve
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### 1. The Core Library (Python)
|
|
43
|
+
If you just want to use the high-performance sketching data structures directly in Python:
|
|
44
|
+
```bash
|
|
45
|
+
pip install sketchlog
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2. The Standalone Server
|
|
49
|
+
To run SketchLog as an independent network service (like Redis or Prometheus):
|
|
50
|
+
```bash
|
|
51
|
+
pip install "sketchlog[server]"
|
|
52
|
+
uvicorn sketchlog.server:app --port 8080
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Quickstart
|
|
58
|
+
|
|
59
|
+
### 🐍 Python (Embedded Library)
|
|
60
|
+
```python
|
|
61
|
+
from sketchlog import StreamLog
|
|
62
|
+
|
|
63
|
+
log = StreamLog()
|
|
64
|
+
log.add_latency(42.5)
|
|
65
|
+
log.add_batch([15.0, 88.2, 42.1])
|
|
66
|
+
log.add_unique("user_12345")
|
|
67
|
+
log.add_event("cache_miss", count=5)
|
|
68
|
+
|
|
69
|
+
print(f"p99 Latency: {log.p99():.2f}ms")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 🟨 TypeScript / Node.js SDK
|
|
73
|
+
Connect to the standalone server via HTTP:
|
|
74
|
+
```bash
|
|
75
|
+
npm install @sketchlog/client
|
|
76
|
+
```
|
|
77
|
+
```typescript
|
|
78
|
+
import { SketchLogClient } from '@sketchlog/client';
|
|
79
|
+
|
|
80
|
+
const client = new SketchLogClient({ endpoint: 'http://localhost:8080' });
|
|
81
|
+
|
|
82
|
+
// Validated HTTP ingestion with bounded retries
|
|
83
|
+
await client.ingestEvents('production_api', {
|
|
84
|
+
latencies: [42.5, 15.0, 88.2, 42.1],
|
|
85
|
+
uniques: ["user_12345"],
|
|
86
|
+
events: { "cache_miss": 5 }
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 🐹 Go SDK
|
|
91
|
+
```bash
|
|
92
|
+
go get github.com/SBALAVIGNESH123/sketchlog/clients/go@v1.2.1
|
|
93
|
+
```
|
|
94
|
+
```go
|
|
95
|
+
import "github.com/SBALAVIGNESH123/sketchlog/clients/go"
|
|
96
|
+
|
|
97
|
+
client := sketchlog.NewClient(sketchlog.ClientOptions{
|
|
98
|
+
Endpoint: "http://localhost:8080",
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
batch := sketchlog.EventBatch{
|
|
102
|
+
Latencies: []float64{42.5, 15.0, 88.2, 42.1},
|
|
103
|
+
Uniques: []string{"user_12345"},
|
|
104
|
+
Events: map[string]int64{"cache_miss": 5},
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
err := client.IngestEvents(ctx, "production_api", batch)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Distributed Clustering (Beta)
|
|
111
|
+
|
|
112
|
+
SketchLog supports multi-node clustering without requiring external coordination services like Redis.
|
|
113
|
+
|
|
114
|
+
You can run a cluster using the following environment variables:
|
|
115
|
+
```bash
|
|
116
|
+
SKETCHLOG_NODE_ID="node-1"
|
|
117
|
+
SKETCHLOG_PEERS="http://node2:8000,http://node3:8000"
|
|
118
|
+
SKETCHLOG_CLUSTER_SECRET="your-secret-token"
|
|
119
|
+
uvicorn sketchlog.server:app --port 8000
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
> **Performance trade-off**: Mesh mode currently uses deterministic Python
|
|
123
|
+
> sketches to guarantee identical merge state across heterogeneous nodes. Measure
|
|
124
|
+
> this mode with your own traffic before capacity planning.
|
|
125
|
+
|
|
126
|
+
## Community
|
|
127
|
+
|
|
128
|
+
Join us in Slack! [Join SketchLog Slack](https://join.slack.com/t/sketchlog/shared_invite/zt-41kc03dnl-tiyHm4Gr2CbaJWuGHxdbiQ)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## What this is not
|
|
133
|
+
|
|
134
|
+
SketchLog is a streaming metrics compression layer. It is deliberately not:
|
|
135
|
+
|
|
136
|
+
- **Not a tracing system.** No request paths, no correlation IDs, no causal chains.
|
|
137
|
+
- **Not a time-series database.** No historical drill-down, no label indexing.
|
|
138
|
+
- **Not an observability platform.** No raw log storage, no ad-hoc queries.
|
|
139
|
+
- **Not exact.** All results are probabilistic with bounded error. If you need exact percentiles, use numpy.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
MIT License
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
We provide security updates for the current major version. Users are strongly encouraged to stay on the latest available minor version.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | ------------------ |
|
|
9
|
+
| 1.x.x | :white_check_mark: |
|
|
10
|
+
| < 1.0.0 | :x: |
|
|
11
|
+
|
|
12
|
+
## Reporting a Vulnerability
|
|
13
|
+
|
|
14
|
+
If you discover a security vulnerability, please do **NOT** open a public issue.
|
|
15
|
+
|
|
16
|
+
Please report all security vulnerabilities via the **[GitHub Security Advisories](https://github.com/SBALAVIGNESH123/sketchlog/security/advisories/new)** tab in this repository. If you do not have access to this feature, please email the project owner directly.
|
|
17
|
+
|
|
18
|
+
### What to Include
|
|
19
|
+
* A clear description of the vulnerability.
|
|
20
|
+
* The versions of Sketchlog affected.
|
|
21
|
+
* A minimal reproduction or Proof of Concept (PoC).
|
|
22
|
+
* Any potential impact or exploit scenarios.
|
|
23
|
+
|
|
24
|
+
### Response Targets
|
|
25
|
+
* **Initial Acknowledgement**: Within 48 hours.
|
|
26
|
+
* **Vulnerability Confirmation & Triage**: Within 5 days.
|
|
27
|
+
* **Patch Development**: Varies by complexity, but we aim for 14 days.
|
|
28
|
+
|
|
29
|
+
## SLA & Release Blocking Policy
|
|
30
|
+
|
|
31
|
+
To protect our users and software supply chain, Sketchlog enforces the following remediation Service Level Agreement (SLA) for confirmed vulnerabilities:
|
|
32
|
+
|
|
33
|
+
* **Critical / High Severity**: Must be patched within 30 days. No new feature releases or non-security patches will be published until the vulnerability is resolved.
|
|
34
|
+
* **Medium / Low Severity**: Will be patched in the next scheduled minor release.
|
|
35
|
+
|
|
36
|
+
## Coordinated Disclosure
|
|
37
|
+
|
|
38
|
+
We believe in responsible, coordinated disclosure. If you report a vulnerability, we ask that you keep the details confidential until we have published a fix and issued an official security advisory. In return, we commit to transparent communication and will credit you (with your permission) in the release notes and advisory.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# PowerShell script to build WASM using Docker
|
|
2
|
+
|
|
3
|
+
Write-Host "Compiling SketchLog to WASM..."
|
|
4
|
+
|
|
5
|
+
if (!(Test-Path "wasm/dist")) {
|
|
6
|
+
New-Item -ItemType Directory -Path "wasm/dist" | Out-Null
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
$CurrentDir = (Get-Item .).FullName
|
|
10
|
+
$EmsdkImage = "emscripten/emsdk:5.0.4@sha256:ef91f658e0104636cf40a702c99169273969cf04d939f4f08e5d0223965d5788"
|
|
11
|
+
|
|
12
|
+
docker run --rm -v "${CurrentDir}:/src" -w /src $EmsdkImage emcc `
|
|
13
|
+
-O3 `
|
|
14
|
+
--bind `
|
|
15
|
+
-Iinclude `
|
|
16
|
+
wasm/bindings.cpp `
|
|
17
|
+
-s MODULARIZE=1 `
|
|
18
|
+
-s EXPORT_NAME="SketchLogModule" `
|
|
19
|
+
-s ALLOW_MEMORY_GROWTH=1 `
|
|
20
|
+
-o wasm/dist/sketchlog.js
|
|
21
|
+
|
|
22
|
+
if ($LASTEXITCODE -ne 0) {
|
|
23
|
+
Write-Error "Docker compilation failed with exit code $LASTEXITCODE"
|
|
24
|
+
exit $LASTEXITCODE
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Write-Host "Successfully built wasm/dist/sketchlog.js and wasm/dist/sketchlog.wasm" -ForegroundColor Green
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
echo "Compiling SketchLog to WASM..."
|
|
5
|
+
|
|
6
|
+
mkdir -p wasm/dist
|
|
7
|
+
|
|
8
|
+
readonly EMSDK_IMAGE="emscripten/emsdk:5.0.4@sha256:ef91f658e0104636cf40a702c99169273969cf04d939f4f08e5d0223965d5788"
|
|
9
|
+
|
|
10
|
+
docker run --rm -v "$(pwd):/src" -w /src -u "$(id -u):$(id -g)" \
|
|
11
|
+
"${EMSDK_IMAGE}" emcc \
|
|
12
|
+
-O3 \
|
|
13
|
+
--bind \
|
|
14
|
+
-Iinclude \
|
|
15
|
+
wasm/bindings.cpp \
|
|
16
|
+
-s MODULARIZE=1 \
|
|
17
|
+
-s EXPORT_NAME="SketchLogModule" \
|
|
18
|
+
-s ALLOW_MEMORY_GROWTH=1 \
|
|
19
|
+
-o wasm/dist/sketchlog.js
|
|
20
|
+
|
|
21
|
+
echo "Successfully built wasm/dist/sketchlog.js and wasm/dist/sketchlog.wasm"
|