Class HttpMetricsClient

java.lang.Object
jline.streaming.HttpMetricsClient

public class HttpMetricsClient extends Object
Simple HTTP client for sending metrics to a receiver. Uses Java's built-in HttpURLConnection for maximum compatibility with all JVM environments including MATLAB. Metrics are sent as JSON via HTTP POST.
  • Constructor Details

    • HttpMetricsClient

      public HttpMetricsClient(String endpoint, String serviceName)
      Create a new HTTP metrics client.
      Parameters:
      endpoint - The HTTP receiver endpoint (e.g., "http://localhost:8080/metrics")
      serviceName - The service name to identify this simulation
    • HttpMetricsClient

      public HttpMetricsClient(String endpoint, String serviceName, boolean failOnConnectionError)
      Create a new HTTP metrics client.
      Parameters:
      endpoint - The HTTP receiver endpoint (e.g., "http://localhost:8080/metrics")
      serviceName - The service name to identify this simulation
      failOnConnectionError - If true, throw exception on connection failure
  • Method Details

    • sendMetrics

      public boolean sendMetrics(List<SSAMetricPoint> metrics)
      Send a batch of metrics to the HTTP receiver.
      Parameters:
      metrics - List of metric points to send
      Returns:
      true if successful, false otherwise
    • isConnectionFailed

      public boolean isConnectionFailed()
      Check if connection has failed.
      Returns:
      true if connection failed and client is in dry-run mode
    • shutdown

      public void shutdown()
      Shutdown the client.