Proto commits in pambrose/prometheus-proxy

These 41 commits are when the Protocol Buffers files have changed:

Commit:5cc70c4
Author:Paul Ambrose
Committer:GitHub

3.0.0 (#117) * Comment out logger calls in HarnessSupport for cleaner code * Refactor Agent and AgentGrpcService to improve scrape request handling and update main method parameters * Refactor ProxyHttpRoutes and ScrapeRequestWrapper to streamline scrape request handling and ensure proper resource cleanup * Update dependencies and add version configuration for Gradle * Update version configuration to improve stability checks and upgrade logging library to 7.0.14 * Update utils library version to 2.5.3 for improved functionality * Downgrade Gradle wrapper to version 9.2.0 and update logback version to 1.5.29 * Refactor ScrapeRequestResponse and ResponseResults to use data classes for immutability and update tests for copy behavior * Refactor metadata handling by consolidating constants into GrpcConstants and updating imports * Refactor AgentContextInfo to use data class for improved immutability and remove unnecessary toString method * Refactor path handling to use removePrefix and removeSurrounding for cleaner code * Refactor AgentContext and AgentContextManager to improve property assignment and encapsulation * Refactor ProxyHttpRoutes to use distinct for status codes and content types, and optimize status message construction * Refactor AgentGrpcService to use ReentrantLock for thread-safe shutdown and stub creation * Refactor AgentHttpService and related classes for improved ScrapeResults handling and encapsulation * Refactor test setup to remove lambda usage for cleaner code * Refactor null checks to use explicit null comparisons for improved readability * Refactor chunk validation to throw ChunkValidationException for mismatches and enhance error handling in ProxyServiceImpl * Fix agent registration to ensure consolidated agents are added on type mismatch in ProxyPathManager * Synchronize agent ID assignment in AgentClientInterceptor to prevent race conditions * Update log message for agent removal in ProxyPathManager for clarity * Refactor request header preparation and improve exception handling in chunk validation * Refactor backlog size management to increment on the consumer side, preventing negative counts and ensuring accurate tracking * Ensure connection context is closed on completion of response writing and result scraping * Rename suspendUntilComplete to awaitCompleted for clarity and consistency in ScrapeRequestWrapper * Reorder agent context management to ensure agent context is added after agent ID validation * Refactor agentContexts to be immutable and enhance test coverage for getAgentContextInfo * Enhance path management by introducing allPathContextInfos method and updating buildServiceDiscoveryJson for improved clarity and efficiency * Refactor AgentClientInterceptor to use next channel parameter and update tests for clarity * Refactor error handling in processScrapeResults and ensure channels are closed after processing * Refactor AgentClientInterceptor to throw an error for missing AGENT_ID key and enhance tests for header handling * Refactor AgentPathManager to use HashMap for pathContextMap and synchronize access for thread safety * Fix race conditions, resource leaks, and synchronization issues in Agent and Proxy packages * Enhance writeChunkedResponsesToProxy to clean up orphaned contexts on stream failure and add corresponding tests * Improve error handling in writeResponsesToProxy and add tests for continued processing after failures * Add unary deadline configuration and update gRPC calls to use it * Add unaryDeadlineSecs option and corresponding tests for AgentOptions * Implement cleanup of agent context in readRequestsFromProxy when transportFilterDisabled and add corresponding tests * Add null checks in tests for AgentHttpService, AgentOptions, and ConfigWrappers * Clarify hashCode contract in AgentContextTest and remove redundant check for unequal objects * Refactor agentContexts to use MutableList in AgentContextInfo to eliminate unsafe casts in path management * Refactor writeChunkedResponsesToProxy to use enum constants for chunk type handling and add tests for CHUNKONEOF_NOT_SET cases * Enhance invalidate method to drain buffered scrape requests and notify HTTP handlers immediately; add tests for proper closure of request wrappers and unblock behavior * Add parsePort function to validate port values and update parseHostPort; enhance tests for error handling * Refactor dynamic parameter handling to avoid setting global system properties; update tests to verify config application without side effects * Refactor onDoneWithClient to return a boolean for client closure; update onFinishedWithClient to close client outside mutex, ensuring non-blocking cache operations during slow I/O * Refactor client closure logic in HttpClientCache to mark in-use clients for closure and close idle clients immediately; add tests to verify behavior for in-use and idle clients * Refactor AgentConnectionContext to use close() instead of cancel() for scrapeResultsChannel, allowing buffered results to be drained; add tests to verify behavior after closure * Enhance shutdown logic in AgentGrpcService to await channel termination; add tests to verify channel state before and after shutdown * Throw StatusRuntimeException with descriptive message when AGENT_ID key is missing in headers; add tests to verify exception behavior * Add test to verify entry count matches completeness list for environment variables * Refactor activity time marking in AgentContext to reduce clock calls and improve performance * Refactor invalidate method in AgentContext to drain scrape request channel and update test to verify behavior * Improve error handling in parseHostPort for malformed IPv6 addresses; update tests to verify exception messages * Fix typo in config.conf: correct "Overide" to "Override" in TLS section * Update logging for keepAliveTimeSecs and keepAliveTimeoutSecs to clarify default values * Add warning log for missing AgentContext in readRequestsFromProxy * Improve tests for AgentContext: update assertions in invalidate method and add consistency check for markActivityTime * Improve awaitCompleted method and add tests for completion scenarios * Ensure response handler is called by requiring non-null result in AgentHttpService * Handle missing X509TrustManager in getTrustManager: return error if not found * Fix typo in ConfigVals: correct "Overide" to "Override" in Javadoc comment * Fix typo in ConfigVals: correct "Overide" to "Override" in Javadoc comment * Add bug report for Prometheus Proxy codebase review with identified issues and suggested fixes * Refactor shutdown logic to prevent deadlocks during concurrent operations * Ensure backlog size consistency in scrape request handling * Handle ClosedSendChannelException in submitScrapeRequest and add corresponding tests * Add invalidateAllAgentContexts method and enhance scrape request handling * Refactor HttpClientCacheTest to use Thread.sleep for slow client simulation and ensure proper dispatcher usage * Invalidate orphaned agent contexts when a non-consolidated agent overwrites a path * Reserve field number 5 in proxy_service.proto to prevent conflicts * Reject consolidated/non-consolidated agent mismatches in addPath method to prevent unexpected behavior * Update agent context validation in addPath method to streamline path addition logic * Rename awaitCompleted parameter from waitMillis to timeout for clarity and add tests to verify Duration handling * Add input validation for parseHostPort function to prevent blank strings * Refactor agent property assignment in ProxyPathManagerTest for improved readability * Add test for variable substitution in ProxyOptions configuration * Enhance boolean environment variable handling with strict parsing and tests * Refactor respondWith function to remove redundant status setting and add integration test for expected behavior * Improve AgentContextCleanupService shutdown behavior with CountDownLatch and add test for prompt shutdown * Refactor BaseOptions to use URI for URL conversion and improve version flag handling with tests * Remove VersionValidator from Utils and update tests to ensure getVersionDesc does not trigger exitProcess * Add mock behavior for pathManager in ProxyServiceImplTest to enhance test coverage * Add isTlsEnabled property and enhance auth header forwarding warning in ProxyHttpRoutes * Add comprehensive bug report detailing fixes and improvements across the Prometheus Proxy codebase * Improve HttpClientCacheTest to enhance concurrency handling during slow client closure * Enhance HttpClientCacheTest to improve concurrency handling during slow client closure * Bump version to 3.0.0 and update related configurations * Add Semaphore CI configuration for Prometheus Proxy * Add unit tests for Agent and Proxy classes to improve test coverage * Add unit tests for AgentGrpcService and ProxyHttpConfig to enhance test coverage * Add unit tests for submitScrapeRequest to improve error handling and response validation * Add unit tests for ChunkedContext and ScrapeRequestWrapper to improve error handling and validation * Add integration tests for ProxyHttpConfig and ProxyHttpRoutes to verify server behavior and response handling * Improve test stability by adding delays to prevent flakiness in HttpClientCacheTest * Refactor tests to use FunSpec style and improve structure for better readability * Refactor test names for clarity and consistency in Admin and Harness tests * Improve test stability in HttpClientCacheTest by adding delays and using mock clients to prevent flakiness * Add coverage configuration to build.gradle.kts and refactor version check logic * Refactor tests to use StringSpec style for improved readability and consistency * Remove Semaphore CI configuration file as it is no longer in use * Refactor AgentHttpService to improve header handling and timeout logic for clarity * Fix HttpClientCache to close idle clients on eviction and cleanup * Add failScrapeRequest method to handle validation failures and notify HTTP handler * Fix backlog counter increment logic in AgentContext to prevent drift on failed writes * Ensure password char array is zeroed after use in getKeyStore method and add tests for validation * Update cache size and age validation to accept 1 as a valid value * Refactor writeScrapeRequest method to simplify backlog size management * Refactor cleanup loop in HttpClientCache to use isActive for coroutine lifecycle management * Refactor AgentPathManager to use ConcurrentHashMap and Mutex for thread-safe path registration * Fix logging in addPath method to prevent IndexOutOfBoundsException and add test for rapid overwrites * Add warning log for disabled X.509 certificate verification in AgentOptions * Fix error logging message format in BaseOptions to improve clarity * Add test for readConfig error message to verify dollar sign interpolation * Improve readability of test code in AgentPathManagerTest * Refactor addPath method to return descriptive error messages on failure and update tests accordingly * Add delay to allow CIO engine to fully initialize in ProxyHttpRoutesTest * Refactor health check to use currentCacheSize method for improved accuracy * Refactor health check test to use currentCacheSize for non-blocking behavior * Fix metrics path formatting to ensure leading slash is present * Enhance registerPath to propagate detailed failure reasons and ensure leading slashes in metrics paths * Refactor scrape request handling to use ConcurrentLinkedQueue for accurate backlog size tracking * Refactor boolean option handling to use resolveBooleanOption for improved clarity and consistency * Refactor TLS configuration handling to require both certificate and key for enabling TLS, and add validation for incomplete configurations * Fail orphaned scrape requests when cleaning up ChunkedContext on stream failure * Add tests to validate scrapeRequestBacklogSize behavior and prevent negative values * Add tests to ensure grpcStarted is correctly managed during channel initialization and shutdown * Ensure grpcStarted is set to true during channel initialization * Fix sendScrapeResults to use trySend() for better error handling on closed channels * Refactor handleConnectionFailure to rethrow JVM Errors and improve error handling * Add overflow protection for chunkContentSizeBytes conversion and enhance tests * Add double-assignment protection to markComplete and enhance tests * Implement mergeContentTexts to handle OpenMetrics EOF markers and add corresponding tests * Enhance agent context invalidation logic to prevent premature invalidation of live agents during path registration * Add comprehensive bug summary and test coverage gap analysis for prometheus-proxy * Refactor AgentConnectionContext to support configurable backlog capacity and improve coroutine management in scrape request processing * Enhance scrape request management to fail requests on agent disconnection and during proxy shutdown * Implement unzipping logic with size limit and handle zip bomb exceptions in scrape request processing * Add configuration for maximum unzipped content size in megabytes * Handle HttpRequestTimeoutException in fetchScrapeUrl and ensure CancellationExceptions are rethrown appropriately * Add GEMINI.md for project overview and development conventions; create gemini-bugs-2-13-26.md for bug reporting * Reset scrapeRequestBacklogSize on connection attempt and handle backlog drift in sendScrapeRequestAction * Remove empty agentContexts from consolidated paths in ProxyPathManager * Add maxZippedContentSize parameter to ChunkedContext and validate content size in applyChunk * Add maxContentLengthMBytes parameter to limit scrape response size * Refactor tests and enhance exception handling in Agent and Proxy components * Add tests for dynamic configuration options in ProxyDynamicConfigTest * Add bug audit report for February 13, 2026, detailing fixes in Agent and Proxy components * Enhance errorCode() to walk cause chain for wrapped timeout exceptions Refactored errorCode() to utilize a new hasTimeoutCause() helper function that checks for wrapped timeout exceptions. Added comprehensive tests to cover various scenarios, including wrapped and deeply nested exceptions. * Update retry policy to only retry on server errors (5xx) and add tests for 4xx responses * Fix CancellationException handling in HttpClientCache cleanup coroutine and add tests * Fix mergeContentTexts to exclude empty content from failed agents and add tests * Fix log level for missing ScrapeRequestWrapper during timeouts and add tests * Fix redundant channel close in writeResponsesToProxyUntilDisconnected and add tests * Fix query param concatenation in fetchScrapeUrl and handle invalid gzip responses in submitScrapeRequest; add tests for both * Increase test scalability by adjusting query counts and add a helper function to start the server * Update configuration paths in documentation and code; move static analysis and config files to 'etc' directory * Update configuration classes and add new metrics options; improve structure and readability * Add Apache License 2.0 to the repository * Add XML declaration to misc.xml for proper parsing * Refactor CLAUDE.md to improve structure and readability; consolidate build commands and testing instructions * Add support for environment variables from secrets file; update .gitignore and XML declaration * Update copyright year to 2026 in multiple files * Remove outdated copyright notice from logback configuration files * Refactor tests to use HARNESS_CONFIG for configuration values; improve readability and consistency * Fix OPTIONS_CONFIG path logic to correctly prepend GH_PREFIX based on JUNIT_FILE existence * Update UtilsTest to use Level for log level management; remove unused imports * Change maxZippedContentSize type to Long to prevent Int overflow; add tests for large values * Fix sendHeartBeat to re-throw NOT_FOUND status for proper reconnection handling; add tests for error propagation * Fix transportFilterDisabled mismatch handling to throw StatusException with FAILED_PRECONDITION; update tests for correct error propagation * Fix onHeaders behavior to cancel call when agent ID key is missing; update tests for correct cancellation and error handling * Fix URL logging to sanitize sensitive information; update tests for byte count discrepancies * Enhance resolveBoolean option handling to support explicit CLI flags; add tests for new behavior * Fix ProxyOptions to handle service discovery configuration correctly; add tests for sdEnabled behavior * Enhance resolveBooleanOption to support additional CLI flags for consolidated, keepAliveWithoutCalls, and trustAllX509Certificates; update related logging * Add sanitizeUrl function to strip credentials from URLs; include tests for various cases * Add 404 Not Found status code handling for invalid paths; include test for fetchScrapeUrl * Throw NOT_FOUND exception when agent context is missing; update tests to verify behavior * Fix high and medium-impact bugs in Prometheus Proxy; address integer overflow, zombie state, gRPC status mismatch, credential leak, content length check, CLI flag handling, and logging issues * Refactor update message handling in ProxyHttpRoutes; change updateMsg to updateMsgs for better support of multiple messages * Implement timeout handling in fetchContent; ensure total fetch time is bounded by scrapeTimeoutSecs and update tests for gzip threshold and retry behavior * Swap gzip and deflate priority values in ProxyHttpConfig; update tests to reflect changes in compression behavior * Enhance close() method in AgentConnectionContext to drain scrapeRequestActionsChannel and return the count of drained requests; update tests to verify behavior * Refactor AgentConnectionContext close() method to return drained request count; update scrapeRequestBacklogSize accordingly. Modify ProxyUtils to use updateMsgs as a list for error responses; adjust tests to verify changes. * Add support for "all" log level in setLogLevel; update tests to verify behavior * Implement atomic decrement for scrapeRequestBacklogSize to prevent negative values during concurrent operations; update close() method in AgentConnectionContext to return drained request count and adjust backlog accordingly. * Fix typo in path variable initialization in BasicHarnessTests * Add tests for decrementBacklog to ensure it clamps at zero and handles concurrency correctly * Fix agent context cleanup and shutdown ordering to prevent resource leaks and improve error messaging * Fix gzip compression for small responses by enforcing minimumSize(1024) in ProxyHttpConfig; add test to verify behavior * Refactor path registration to allow concurrent operations by moving gRPC calls outside of the mutex; update tests to verify behavior * Fix logging for agent context removal and improve handling of double removals; add tests to verify behavior * Fix applySummary to correctly propagate headerZipped value; update tests to verify behavior * Fix toScrapeResponseHeader to propagate srZipped value; add tests to verify behavior * Refactor tests to improve compile-time safety and enhance concurrency; update response handling for compression * Fix integer overflow in totalByteCount and ensure proper handling of large accumulated chunks; add tests to verify behavior * Fix input validation in ChunkedContext.applyChunk and address TOCTOU race in AgentContextCleanupService; add tests to verify behavior * Update README to reflect changes in log level options and correct servlet documentation URL * Update README to include proxy content size limits for chunked transfers * Add release notes for version 3.0.0 with bug fixes, new features, refactoring, and breaking changes * Remove Travis CI configuration as it is no longer in use * Rename RELEASE-NOTES.md to RELEASE_NOTES.md for consistency * Add improvements document outlining code quality, performance, security, and maintainability suggestions * Add KDoc documentation summary and README feedback for improved clarity and test coverage * Fix parseHostPort to remove brackets from IPv6 addresses in HostPort * Add KDoc documentation summary and test coverage details for Prometheus Proxy * Add KDoc documentation for agent connection and proxy services * Update KDoc summary to document internal service classes and improve test coverage suggestions * Add Dokka integration for API documentation generation * Add documentation for Prometheus Proxy module and its packages * Update KDoc references to use fully qualified names for Agent and Proxy classes * Add GitHub Actions workflow for deploying Dokka documentation to GitHub Pages * Add CI workflow for building the project using GitHub Actions * Add GitHub Actions CI workflow for building and deploying documentation * Add environment variable for Harness configuration in CI workflow * Update CI workflow to skip tests during build and run specific tests for Prometheus components * Comment out specific test runs for Prometheus components in CI workflow

Commit:0db8810
Author:Paul Ambrose
Committer:GitHub

1.23.0 (#101) * Update to Kotlin 2.1.0, Ktor 3.0.1, and gRPC 1.68.2 * Change minimum JDK from 17 to 11 * Remove krotodc library * Convert build.gradle to build.gradle.kts * Add support for gRPC reflection * Add support for service discovery labels in pathConfigs

The documentation is generated from this commit.

Commit:b4f646d
Author:Paul Ambrose
Committer:GitHub

Add support for using nginx as a reverse proxy for prometheus_proxy (#85)

Commit:ab4eafa
Author:Wolfgang Jung
Committer:GitHub

Adds Authorization Header to proxied requests (#70) * Adds Authorization Header to proxied requests For retrieving password/JWT-protected endpoints with the default prometheus mechanisms, the Authorization-Header is passed transparently from the request to the proxy-endpoint to the http call made by the agent. * Adds documentation to proxied Authorization Headers Authored-by: Wolfgang Jung <w.jung@polyas.de>

Commit:a1e8d04
Author:Paul Ambrose
Committer:GitHub

1.7.1 * Make agent embeddable * Fix problem in agent cleanup removal

Commit:29b870d
Author:Paul Ambrose
Committer:GitHub

1.6.4 * Update jars * Add support for passing query params from proxy to agent

Commit:7dd5441
Author:pambrose

Add support for passing query params

Commit:6f72a28
Author:Paul Ambrose
Committer:GitHub

1.6.2 (#34) * Create 1.6.2 release * Rename NonChunkedScrapeResponse to ScrapeResponse * Rename NonChunkedScrapeResponse to ScrapeResponse * Add support for min gzip size * Add support for min gzip size * Add support for min gzip size * Add support for min gzip size * Add support for min gzip size * Add support for min gzip size

Commit:c3af2f5
Author:Paul Ambrose
Committer:GitHub

1.6.1 * Zip chunked and non-chunked content

Commit:39726dd
Author:Paul Ambrose
Committer:GitHub

1.6.0 * Add support for large ScrapeResponse msgs

Commit:4485c1f
Author:Paul Ambrose
Committer:GitHub

1.4.5 * Add debug servlet

Commit:d2c5ed8
Author:Paul Ambrose
Committer:GitHub

1.4.3 * Cleanup Agent

Commit:6c25766
Author:Paul Ambrose
Committer:GitHub

1.4.0 * Update jars * Add coroutines * Add ktor server * Update kotlin to 1.3.50 * Convert to Durations * Switch from maven to gradle * Split java and kotlin code into their respective dirs

Commit:d3b7616
Author:Paul Ambrose
Committer:GitHub

Add Kotlin idioms * Kotlin conversion * Add AtomicDelegates

Commit:e330fac
Author:Paul Ambrose

Rename package

Commit:d2ce555
Author:Paul Ambrose

Code cleanup

Commit:6564095
Author:Paul Ambrose

Add more tests

Commit:a70c4a7
Author:Paul Ambrose

Add support travis tests

Commit:4e38cd7
Author:Paul Ambrose

Added support for removing inactive agents

Commit:8e75d67
Author:Paul Ambrose

Add agent heartbeat

Commit:422d8dc
Author:Paul Ambrose

Add agent name

Commit:ed968c9
Author:Paul Ambrose

Add zipkin trace for entire request

Commit:ace9a30
Author:Paul Ambrose

Propagate accept and content_type header values

Commit:c97d7d9
Author:Paul Ambrose

Convert scrape results call to stream

Commit:6e33f4b
Author:Paul Ambrose

Add valid flag to responses

Commit:3425873
Author:Paul Ambrose

Convert to logback logging

Commit:af7e258
Author:Paul Ambrose

Initial commit

Commit:a8a7fe8
Author:Paul Ambrose

Initial commit

Commit:9c1e57b
Author:Paul Ambrose

Initial commit

Commit:2da5e6c
Author:Paul Ambrose

Initial commit

Commit:4d6de47
Author:Paul Ambrose

Initial commit

Commit:c3059f0
Author:Paul Ambrose

Initial commit

Commit:3fcafed
Author:Paul Ambrose

Initial commit

Commit:6df7aa5
Author:Paul Ambrose

Initial commit

Commit:2c46cc4
Author:Paul Ambrose

Initial commit

Commit:6999a30
Author:Paul Ambrose

Initial commit

Commit:7c0e98c
Author:Paul Ambrose

Initial commit

Commit:1e2de49
Author:Paul Ambrose

Initial commit

Commit:c7d10ae
Author:Paul Ambrose

Initial commit

Commit:0d3a38a
Author:Paul Ambrose

Initial commit

Commit:f879191
Author:Paul Ambrose

Initial commit