Commit Graph
100 Commits
Author SHA1 Message Date
lukaszraczyloandGitHub 92da4af001 Update go.mod and go.sum (#83) 2026-04-01 05:02:25 +01:00
lukaszraczyloandGitHub c68dc2f20a Update go.mod and go.sum (#82) 2026-03-31 04:56:07 +01:00
lukaszraczyloandGitHub 11ff751001 Update go.mod and go.sum (#81) 2026-03-23 03:53:38 +00:00
lukaszraczyloandGitHub 0414473f15 Update go.mod and go.sum (#80) 2026-03-22 03:49:12 +00:00
lukaszraczyloandGitHub bc61557015 Update go.mod and go.sum (#79) 2026-03-21 03:42:49 +00:00
lukaszraczyloandGitHub 12ec00f697 Update go.mod and go.sum (#78) 2026-03-20 03:45:16 +00:00
lukaszraczyloandGitHub da4a179d66 Update go.mod and go.sum (#77) 2026-03-18 03:51:52 +00:00
lukaszraczyloandGitHub d0ecefce6c Update go.mod and go.sum (#76) 2026-03-17 03:46:12 +00:00
lukaszraczyloandGitHub c742530d2f Update go.mod and go.sum (#75) 2026-03-13 03:46:36 +00:00
lukaszraczyloandGitHub 7304559801 Update go.mod and go.sum (#74) 2026-03-12 03:45:51 +00:00
lukaszraczyloandGitHub aa46992497 Update go.mod and go.sum (#73) 2026-03-10 03:45:15 +00:00
lukaszraczyloandGitHub e968a48584 Update go.mod and go.sum (#72) 2026-03-09 03:47:33 +00:00
lukaszraczyloandGitHub c67dfe1827 Update go.mod and go.sum (#71) 2026-03-08 03:46:25 +00:00
lukaszraczyloandGitHub 55d86e34cf Update go.mod and go.sum (#70) 2026-03-07 03:37:20 +00:00
lukaszraczyloandGitHub cd4a1f16ed Update go.mod and go.sum (#69) 2026-03-03 03:46:23 +00:00
lukaszraczyloandGitHub 3352050bdb Update go.mod and go.sum (#68) 2026-02-27 03:46:24 +00:00
lukaszraczyloandGitHub bb2509e254 Update go.mod and go.sum (#67) 2026-02-26 03:47:30 +00:00
lukaszraczyloandGitHub d027122446 Update go.mod and go.sum (#66) 2026-02-25 03:48:58 +00:00
lukaszraczyloandGitHub 3abbaf66a1 Update go.mod and go.sum (#65) 2026-02-24 03:47:16 +00:00
lukaszraczyloandGitHub f8871a4fb7 Update go.mod and go.sum (#64) 2026-02-19 03:49:36 +00:00
lukaszraczyloandGitHub 420e63f383 Update go.mod and go.sum (#63) 2026-02-18 03:50:04 +00:00
lukaszraczyloandGitHub 9bd9f0b9ba Update go.mod and go.sum (#62) 2026-02-17 03:47:17 +00:00
lukaszraczyloandGitHub 31cb5930d5 Update go.mod and go.sum (#61) 2026-02-15 03:51:37 +00:00
lukaszraczyloandGitHub 454e1d2425 Update go.mod and go.sum (#60) 2026-02-14 03:46:07 +00:00
lukaszraczyloandGitHub 98afa39943 Update go.mod and go.sum (#59) 2026-02-11 03:57:00 +00:00
lukaszraczyloandGitHub 6605c59efd Update go.mod and go.sum (#58) 2026-02-10 03:58:10 +00:00
lukaszraczyloandGitHub f87f2ae5a2 Update go.mod and go.sum (#57) 2026-02-09 03:52:03 +00:00
lukaszraczyloandGitHub 04f6deb0a8 Update go.mod and go.sum (#56) 2026-02-04 03:46:40 +00:00
lukaszraczyloandGitHub 5ea41ea268 Update go.mod and go.sum (#55) 2026-02-03 03:47:55 +00:00
lukaszraczyloandGitHub b8b814a9be Update go.mod and go.sum (#54) 2026-02-02 03:51:10 +00:00
lukaszraczyloandGitHub 5b79b49b00 Update go.mod and go.sum (#53) 2026-02-01 03:55:03 +00:00
lukaszraczyloandGitHub bdbf829a59 Update go.mod and go.sum (#52) 2026-01-30 03:45:32 +00:00
lukaszraczyloandGitHub dcff327745 Update go.mod and go.sum (#51) 2026-01-29 03:45:20 +00:00
lukaszraczyloandGitHub f2997c4c9f Update go.mod and go.sum (#50) 2026-01-28 03:32:18 +00:00
lukaszraczyloandGitHub c3fe0471df Update go.mod and go.sum (#49) 2026-01-27 03:32:38 +00:00
lukaszraczyloandGitHub d62c718682 Update go.mod and go.sum (#48) 2026-01-26 03:37:18 +00:00
lukaszraczyloandGitHub 26cebee756 Update go.mod and go.sum (#47) 2026-01-25 03:33:49 +00:00
lukaszraczyloandGitHub acace4fe16 Update go.mod and go.sum (#46) 2026-01-23 03:32:22 +00:00
lukaszraczyloandGitHub f6fc338c8c Update go.mod and go.sum (#45) 2026-01-22 03:32:34 +00:00
lukaszraczyloandGitHub 9b792c3c64 Update go.mod and go.sum (#44) 2026-01-21 03:30:16 +00:00
lukaszraczyloandGitHub d3fe02aa52 Update go.mod and go.sum (#43) 2026-01-19 03:31:38 +00:00
lukaszraczyloandGitHub 82000bfb4c Update go.mod and go.sum (#42) 2026-01-17 03:29:33 +00:00
lukaszraczyloandGitHub 3aa83d4480 chore(security,refactor): extract sanitization and improve code quality (#41)
* chore(security,refactor): extract sanitization and improve code quality

- [x] Extract sanitization functions to dedicated sanitization.go module
- [x] Add comprehensive golangci-lint v2 configuration with security rules
- [x] Replace interface{} with any type throughout codebase
- [x] Add admin API authentication security warning
- [x] Extract WebSocket and stats streaming constants
- [x] Add best-effort error handling comments for resource cleanup
- [x] Expand sensitive field patterns for improved PII redaction
- [x] Simplify safety checks and remove redundant nil validations
- [x] Improve test coverage for password field redaction patterns

* refactor: replace interface{} with any type alias

- [x] Replace all `map[string]interface{}` with `map[string]any`
- [x] Replace all `interface{}` with `any` in function signatures and type definitions
- [x] Update sync.Pool New function returns from `interface{}` to `any`
- [x] Add package documentation comments to 8 package files
- [x] Update type assertions and casts to work with `any` type
2026-01-17 00:04:12 +00:00
lukaszraczyloandGitHub caeae62236 Update go.mod and go.sum (#40) 2026-01-15 03:30:11 +00:00
lukaszraczyloandGitHub 0e1deab8ed Update go.mod and go.sum (#39) 2026-01-13 03:29:26 +00:00
lukaszraczyloandGitHub 67b0bebbc3 Update go.mod and go.sum (#38) 2026-01-10 03:30:19 +00:00
lukaszraczyloandGitHub 92c2c162d8 Update go.mod and go.sum (#37) 2026-01-09 03:30:01 +00:00
lukaszraczyloandGitHub 8367812a48 Update go.mod and go.sum (#36) 2026-01-06 03:29:35 +00:00
lukaszraczyloandGitHub 86fa0551df Update go.mod and go.sum (#35) 2025-12-27 03:30:00 +00:00
lukaszraczyloandGitHub 4be6b0f6cf Update go.mod and go.sum (#34) 2025-12-25 03:30:50 +00:00
lukaszraczyloandGitHub 6bc4cfd916 Update go.mod and go.sum (#33) 2025-12-24 03:30:40 +00:00
lukaszraczyloandGitHub a3093fe2d1 Update go.mod and go.sum (#32) 2025-12-23 03:29:03 +00:00
lukaszraczylo c0f5f0830d Add signing of the builds 2025-12-15 00:42:45 +00:00
lukaszraczylo 623cbbcae3 Add signing images and binaries. 2025-12-14 23:38:06 +00:00
lukaszraczyloandGitHub 05a07fde42 Update go.mod and go.sum (#31) 2025-12-13 03:23:40 +00:00
lukaszraczyloandGitHub c926d0d0a3 Update go.mod and go.sum (#30) 2025-12-09 22:29:00 +00:00
lukaszraczylo 6c96880eae fixup! Use shared PR workflow. 2025-12-09 22:25:34 +00:00
lukaszraczylo 7f78869a8a Use shared PR workflow. 2025-12-08 01:31:15 +00:00
lukaszraczylo 794ec6a752 Trigger autoupdate. 2025-12-08 01:13:03 +00:00
lukaszraczylo 9678b8f7b9 fixup! fixup! fixup! Github pages + benchmarks. 2025-12-07 17:00:33 +00:00
lukaszraczylo 7bb76893f5 fixup! fixup! Github pages + benchmarks. 2025-12-07 16:53:54 +00:00
lukaszraczylo 4ef42e5781 fixup! Github pages + benchmarks. 2025-12-07 16:49:50 +00:00
lukaszraczylo 996d29b57b Github pages + benchmarks. 2025-12-07 16:46:13 +00:00
lukaszraczyloandGitHub 7c80d6adaa Create CNAME 2025-12-07 16:45:33 +00:00
lukaszraczylo 31fc3ae3d9 Switch to goreleaser. 2025-12-07 16:13:33 +00:00
lukaszraczylo da8ec5f21d Add LRU cache support. 2025-12-03 10:22:33 +00:00
lukaszraczylo d07ee4090c Dashboard update. 2025-11-29 15:53:05 +00:00
lukaszraczylo b1045b8bc2 Retry budget. 2025-11-29 15:36:17 +00:00
lukaszraczylo cc35031db9 Fixes issue with the dashboard metrics. 2025-11-29 14:51:29 +00:00
lukaszraczyloandGitHub 6a69694ab3 November improvements. (#29)
* Tackling the CPU / memory spikes after some time.

* Update admin dashboard, fix the circuit breaker and request coalescing.
2025-11-29 14:21:09 +00:00
lukaszraczylo c99bf2b245 fixup! Improve caching by adding user ids and roles to hash. 2025-11-22 17:10:59 +00:00
lukaszraczylo 39dc7b49cf Improve caching by adding user ids and roles to hash. 2025-11-22 17:02:16 +00:00
lukaszraczylo 94c097bc6c fixup! Race condition in parseGraphQLQuery result pooling 2025-11-18 17:27:55 +00:00
lukaszraczylo 4e84cd7461 Race condition in parseGraphQLQuery result pooling
Under high concurrency, the sync.Pool pattern was creating a race condition
where the same result pointer was being reused by multiple concurrent requests.

The bug:
- parseGraphQLQuery() returns a pointer to 'res' from the pool
- The defer statement returns 'res' back to the pool on function exit
- While the caller is still using the returned pointer, another concurrent
  request could get the SAME pointer from the pool and modify it

This caused mutations to randomly get the wrong activeEndpoint value:
- Request A: mutation parsed → activeEndpoint set to :8080 (write)
- Request A: returns pointer to result
- Request A: defer runs → result returned to pool
- Request B: gets SAME pointer from pool
- Request B: query parsed → activeEndpoint overwritten to :8088 (read-only)
- Request A: still holding pointer, now sees :8088 instead of :8080!
- Result: mutation routed to read-only endpoint → database write failure

The fix:
Create a copy of the result before returning, so the pooled object can be
safely reused without affecting the returned value.
2025-11-18 17:03:11 +00:00
lukaszraczylo e37a8beaa7 Fix: Move endpoint routing outside loop to prevent mutation misrouting
BUG FIX: The endpoint routing logic was inside the loop that
processes all GraphQL definitions. This caused mutations to be incorrectly
routed to read-only endpoints when followed by other definitions (queries,
fragments, etc).

The bug manifested as: mutations → read-only Hasura → read-only pooler →
PostgreSQL replica → "cannot set transaction read-write mode during recovery"

Changes:
- Move endpoint routing logic AFTER the definition processing loop
- Ensures mutations are ALWAYS routed to write endpoint regardless of
  subsequent definitions in the document
- Add 3 comprehensive regression tests covering:
  1. Mutation with multiple operations
  2. Mutation followed by fragment
  3. Complex main-bot style mutation document

Tests: All pass including new regression tests
Impact: Fixes database write failures in main-bot and other services
2025-11-18 17:03:06 +00:00
lukaszraczylo 9dd8c11363 CRITICAL: Routing fix for mutations in case of the R/W replicas 2025-11-18 16:28:58 +00:00
lukaszraczylo 7ada94e4fa Fix nil pointers + improve the cleanup. 2025-11-11 10:43:07 +00:00
lukaszraczylo 6261be6e53 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Update go.mod and go.sum 2025-11-06 16:55:12 +00:00
lukaszraczylo 5ae4ea1e25 fixup! fixup! fixup! fixup! fixup! fixup! fixup! Update go.mod and go.sum 2025-11-05 22:55:03 +00:00
lukaszraczylo fd30dc0890 fixup! fixup! fixup! fixup! fixup! fixup! Update go.mod and go.sum 2025-11-05 21:56:29 +00:00
lukaszraczylo 2966661054 fixup! fixup! fixup! fixup! fixup! Update go.mod and go.sum 2025-11-05 21:47:40 +00:00
lukaszraczylo 0f23f10e2f fixup! fixup! fixup! fixup! Update go.mod and go.sum 2025-11-05 21:34:21 +00:00
lukaszraczylo ce39dc1bee fixup! fixup! fixup! Update go.mod and go.sum 2025-11-05 20:58:41 +00:00
lukaszraczylo f864e8edcf fixup! fixup! Update go.mod and go.sum 2025-11-05 20:28:31 +00:00
lukaszraczylo e36cdf099e fixup! Update go.mod and go.sum 2025-11-05 10:27:18 +00:00
e3e9f7d181 improvements mid apr 2025 (#27)
* General improvements and bug fixes.

* Improve tests coverage.

* fixup! Improve tests coverage.

* Update README.md with latest changes.

* Fix the uint32

* Resolve issue with race condition for logging.

* fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* Fix the test of the rate limiter

* Add default ratelimit.json file

* Update dependencies.

* Significant refactor.

* fixup! Significant refactor.

* fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* Enhance admin dashboard with real-time WebSocket streaming and charts

Dashboard improvements:
- Added Chart.js for time-series visualization
- Created real-time graphs for RPS and cache hit rate
- Added new statistics displays:
  * System uptime with human-readable format
  * Total requests with success/failure breakdown
  * Current and average RPS
  * Success rate with progress bars
  * Cache hit rate and memory usage with visual indicators
  * Detailed cache statistics
- Implemented WebSocket streaming endpoint (/admin/ws/stats)
- Real-time updates every 2 seconds via WebSocket
- Automatic fallback to polling if WebSocket unavailable
- Connection status indicator
- Progress bars for success rate, cache hit rate, and memory usage

Backend enhancements:
- New WebSocket handler for streaming all statistics
- gatherAllStats() method to collect comprehensive metrics
- Streams data every 2 seconds to connected clients
- Automatic reconnection handling
- Maintains up to 60 data points per chart

The dashboard now provides comprehensive real-time monitoring with:
- Live metrics streaming
- Historical trend visualization
- Responsive design with visual indicators
- Graceful degradation to polling mode

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix WebSocket message handling for real-time stats streaming

Issues fixed:
- Removed blocking default case that prevented ticker from firing
- Separated read and write operations into proper goroutines
- Added proper ping/pong handlers with read deadlines
- Implemented done channel for clean disconnection signaling
- Send initial stats immediately on connection

The WebSocket now properly:
- Streams stats every 2 seconds via ticker
- Handles client disconnections gracefully
- Maintains connection with ping/pong
- Detects connection drops via read goroutine
- Non-blocking message handling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add Redis-based cluster mode for distributed metrics aggregation

When using Redis for caching, proxies now automatically form a cluster
and aggregate metrics across all instances for unified monitoring.

Features:
- Metrics Aggregator: Publishes instance metrics to Redis every 5s
- Cluster Mode API: /admin/api/cluster/stats and /admin/api/cluster/instances
- Dashboard Cluster View: Toggle between single instance and cluster view
- Auto-discovery: Detects cluster mode automatically via Redis
- Instance Management: Each instance gets unique ID (hostname + UUID)
- Graceful Cleanup: Removes metrics from Redis on shutdown
- TTL-based expiration: Stale instances auto-expire after 30s

Cluster metrics include:
- Aggregated requests (total, succeeded, failed, success rate)
- Combined RPS across all instances
- Total cache hits/misses with cluster-wide hit rate
- Per-instance health status and uptime
- Active connections and WebSocket stats
- Request coalescing backend savings

Dashboard improvements:
- Cluster Status section showing total/healthy instances
- Instance Details section with per-node metrics
- Cluster View toggle in header
- Automatic detection of cluster availability
- Individual instance cards with health indicators
- "Current" badge for the instance you're viewing

Architecture:
- Uses Redis SET to track active instances
- Each instance publishes to redis key: graphql-proxy:metrics:instances:{id}
- 30s TTL ensures stale instances are removed
- Aggregator started automatically when Redis cache enabled
- Registered with shutdown manager for graceful cleanup

Environment: Automatically enabled when ENABLE_REDIS_CACHE=true

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix cluster instance details using correct JSON field names

JavaScript was using Go struct field names (PascalCase) instead of
JSON field names (snake_case), causing all instance metrics to show
as 0 or undefined.

Fixed references:
- instance.InstanceID → instance.instance_id
- instance.Hostname → instance.hostname
- instance.UptimeSeconds → instance.uptime_seconds
- instance.Stats → instance.stats
- instance.Health → instance.health

Also added fallback to check both instance.cache_summary and
stats.cache_summary for better compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Enhance Cluster View toggle visibility and styling

Improvements:
- Replaced basic checkbox with custom toggle switch
- Added prominent card-style container with backdrop blur
- Positioned toggle in header next to dashboard title
- Toggle switch with smooth animation (slides left/right)
- Green color when enabled (#10b981)
- Hover effects with slight lift
- Better typography with font weights and spacing
- Info text positioned below toggle label
- Disabled state with reduced opacity
- Responsive layout with flexbox

The toggle is now much more visible and professional-looking,
making it clear when cluster mode is available and active.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add comprehensive debugging for cluster mode metrics issues

Backend improvements:
- Fixed metrics structure: ensure Stats always has correct inner structure
- Added defensive nil checks for instance.Stats in aggregation
- Added debug logging in publishMetrics to verify data being sent
- Added warning logging in aggregateStats when data is missing
- Log actual keys present in Stats when 'requests' is missing
- Initialize empty maps instead of leaving fields nil

Frontend improvements:
- Added console.log statements to trace cluster data flow
- Log cluster data structure on receive
- Log stats keys and structure
- Log instances array and count
- Warn when expected data is missing
- Added fallback values (|| 0) for display fields

This will help diagnose why cluster view shows zeros by logging:
1. What data is being published to Redis
2. What data is being retrieved from Redis
3. What structure the data has at each step
4. What keys are present vs expected

Check browser console and server logs to see where the data flow breaks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add cluster debug endpoint for troubleshooting

New endpoint: GET /admin/api/cluster/debug

Returns comprehensive debug information:
- Whether metrics aggregator is initialized
- Redis cache enabled status
- Current instance ID
- Cluster mode status
- Total/healthy instance counts
- Sample instance structure with keys
- Sample requests data structure
- Error messages if any

This helps diagnose cluster mode issues by showing:
1. If Redis is actually enabled
2. If aggregator is initialized
3. What data structure is being stored
4. What keys are present in Stats
5. Sample of actual data being aggregated

Visit http://localhost:8181/admin/api/cluster/debug to see
what's happening under the hood.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix cluster mode initialization and improve Redis error visibility

Critical fixes:
1. Move metrics aggregator initialization BEFORE cache initialization
   - Runs independently even if CacheEnable=false
   - Only requires CacheRedisEnable=true
   - This was causing aggregator to not initialize when cache was disabled

2. Promote Redis errors from Warning to Error level
   - Changed "Failed to publish" from Warning to Error with ❌ CRITICAL prefix
   - Added detailed error context (instance_id, keys, error message)
   - Added success logging with ✓ confirmation
   - Log command count and data size on success

3. Enhanced startup logging
   - Log "Initializing metrics aggregator" with Redis URL/DB
   - Log "✓ Successfully initialized" with instance ID
   - Log "FAILED to initialize" as ERROR (was Warning)

Why this matters:
- If Redis cache is disabled but Redis is available, cluster mode should still work
- Previous code only initialized aggregator inside cache initialization block
- Redis publish errors were being silently logged as warnings
- No visibility into whether metrics were actually being stored

After this fix:
- Cluster mode works even with ENABLE_GLOBAL_CACHE=false + ENABLE_REDIS_CACHE=true
- Redis errors are immediately visible in logs
- Clear success/failure indicators
- Better troubleshooting information

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add force-publish endpoint for cluster mode debugging

New endpoint: POST /admin/api/cluster/force-publish

Forces an immediate metrics publish to Redis and reports results.
This helps diagnose why instances aren't appearing:

Response includes:
- success: true/false
- publish_done: confirmation publish was attempted
- instances_found: count after publish
- error: if retrieval failed
- check_logs: reminder to look for log messages

Use this to test:
curl -X POST http://localhost:8181/admin/api/cluster/force-publish

Then check server logs for:
✓ Successfully published metrics to Redis
OR
❌ CRITICAL: Failed to publish metrics to Redis

This bypasses the 5-second timer and publishes immediately,
making it easier to test without waiting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix cluster metrics aggregation and dashboard display issues

- Fix metric names: use correct Prometheus metric names (requests_succesful, requests_failed, requests_skipped)
- Add automatic stale instance cleanup (>1 minute inactive)
- Implement 10-second moving average smoothing for RPS, success rate, and cache hit rate
- Add trend indicators (↑ ↗ → ↘ ↓) to show metric direction
- Add compact number formatting (1.2M, 3.4K) with full-value tooltips
- Add retry budget aggregation (allowed/denied retries, denial rate)
- Add circuit breaker aggregation (state counts, per-instance breakdown)
- Add coalescing stats aggregation (backend savings percentage)
- Fix memory display to show "N/A" for Redis cache (memory tracking not available)
- Fix JavaScript error: change hitRate to smoothedHitRate in chart update call
- Change Redis operations to use context.Background() instead of parent context
- Fix staticcheck warning: omit nil check for map len()

This resolves cluster view showing zeros and prevents metrics from disappearing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix cluster instance count not updating in upper right corner

The cluster-info element (showing instance count next to "Cluster View" toggle)
was only updated during initial page load. Now it updates in real-time whenever
cluster stats are received via WebSocket.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Clean up verbose debug logging

Removed debug console.log statements from dashboard JavaScript:
- WebSocket connection/disconnection logs
- Cluster mode availability checks
- Cluster stats update debug logs

Removed verbose Info logs from Go code that ran frequently:
- "Publishing metrics to Redis" (every 5s)
- "Metrics gathered successfully" (every 5s)
- "Successfully published metrics to Redis" (every 5s)
- "Aggregating stats from instances" (frequently)
- "Successfully aggregated cluster metrics" (frequently)
- "Aggregation complete" (frequently)

Kept important logs:
- Error and warning logs
- Initialization and shutdown logs
- Conditional logs (stale instance cleanup, failures)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
2025-10-01 00:25:32 +01:00
lukaszraczyloandGitHub 0fc776228f improvements mid apr 2025 (#26)
* General improvements and bug fixes.
* Admin dashboard
2025-10-01 00:20:45 +01:00
lukaszraczyloandGitHub cedee416a8 improvements mid may 2025 (#24)
* General improvements and bug fixes.

* Improve tests coverage.

* fixup! Improve tests coverage.

* Update README.md with latest changes.

* Fix the uint32

* Resolve issue with race condition for logging.

* fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* Fix the test of the rate limiter

* Add default ratelimit.json file

* Update dependencies.

* Significant refactor.

* fixup! Significant refactor.

* fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025

* fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025
2025-09-30 18:27:33 +01:00
lukaszraczylo 76950408ae Add codeowners. 2025-03-21 09:40:37 +00:00
lukaszraczylo ac43b24da1 Dummy commit. 2025-02-28 19:10:12 +00:00
lukaszraczylo 66e973e715 Fixup govet 2025-02-26 01:27:23 +00:00
lukaszraczylo 5e9fe30704 fixup! fixup! fixup! Gofmt the codebase. 2025-02-26 01:08:23 +00:00
lukaszraczylo 8104f83cac fixup! fixup! Gofmt the codebase. 2025-02-26 01:04:02 +00:00
lukaszraczylo 98a5234ff6 fixup! Gofmt the codebase. 2025-02-26 01:03:44 +00:00
lukaszraczylo 1b7890f322 Gofmt the codebase. 2025-02-26 00:47:41 +00:00
lukaszraczylo 66c8fef24d Improve the test coverage 2025-02-26 00:44:14 +00:00
lukaszraczylo d83c3a4567 Increase tests coverage. 2025-02-25 23:55:25 +00:00
lukaszraczylo 2ab78d35ce Configuration Management:
Optimized the getDetailsFromEnv function to reduce redundant lookups and improve type handling
Added direct environment variable access for better performance

Memory Cache Optimization:

Implemented a size-based compression threshold (1KB) to avoid compressing small payloads
Added cache size limits (10,000 entries) to prevent memory leaks
Implemented efficient eviction strategies for the oldest entries
Added atomic counter for thread-safe cache size tracking
Improved cleanup routines with GC triggering for large caches

Proxy Implementation:

Refactored the proxy code into smaller, focused functions for better maintainability
Optimized gzip handling for better performance
Improved error handling and logging
Enhanced tracing integration

GraphQL Processing:

Optimized introspection query checking with fast-path returns
Improved object pool usage
Added detailed comments for better code understanding
Split complex functions into smaller, more focused ones
Fixed test compatibility issues with introspection checking

Request Processing:

Refactored the request processing logic into smaller, focused functions
Separated user extraction, caching, and request handling for better maintainability
Improved error handling and response generation

Tracing Enhancements:

Added better span context management
Implemented custom attributes for more detailed tracing
Added sampling configuration to reduce overhead
Improved resource attribution with host and process information
Added timeout handling for tracing operations

Application Lifecycle:

Implemented graceful shutdown with proper signal handling
Added goroutine management with wait groups
Improved startup sequence with better error handling
Added timeout handling for shutdown operations
2025-02-25 23:34:39 +00:00
lukaszraczyloandGitHub 6af5aefe54 Add tracing and relevant tests (#21)
* Add tracing and relevant tests.

* fixup! Add tracing and relevant tests.

* gofmt the code 🤷

* fixup! gofmt the code 🤷
2025-01-08 18:29:25 +00:00
lukaszraczylo 984e448ff0 fixup! fixup! Fixes the code for additional test cases. 2024-12-06 13:27:59 +00:00