Skip to content

Feature: add Controller and Service for the connection-pool #7575

@Oscarcheng0312

Description

@Oscarcheng0312

Check Ahead

  • I have searched the issues of this repository and believe that this is not a duplicate.

  • I am willing to try to implement this feature myself.

Why you need it?

Seata currently lacks a REST-based controller and service layer for connection-pool monitoring. Without these, the Console UI cannot:

  • The Console UI cannot fetch live pool metrics (active, idle, total connections).
  • There is no way to view or update pool configuration (maxPoolSize, minIdle, timeouts) at runtime.
  • Time-series data (e.g. pool size trends, SQL execution histograms) cannot be streamed to the Console.

This makes it impossible to monitor and dynamically tune connection pools from the Seata Console, limiting operational visibility and runtime adjustments.

How it could be?

  1. ConnectionPoolController (/api/v1/connection-pool)

    • GET /health{ status: "UP" | "DOWN", registeredServices: <int>, timestamp: <ms> }
    • GET /services{ services: [String], count: <int> }
    • GET /metricsList<ConnectionPoolMetrics> (all services)
    • GET /metrics/{serviceName}?includeTransactionChart={bool}&includeSqlChart={bool} → detailed JSON with common metrics + optional histograms & slow-SQL list
    • GET /configList<ConnectionPoolConfig>
    • GET /config/{serviceName} → single ConnectionPoolConfig
    • PUT /config/{serviceName} → accept ConnectionPoolConfig JSON to update settings
    • GET /info/{serviceName} → combined { serviceName, metrics, config, timestamp }
  2. ConnectionPoolService

    • getMetrics(String serviceName): ConnectionPoolMetrics
    • getAllMetrics(): List<ConnectionPoolMetrics>
    • getConfig(String serviceName): ConnectionPoolConfig
    • updateConfig(String serviceName, ConnectionPoolConfig cfg)
    • getAllServiceNames(): List<String>
    • isServiceRegistered(String serviceName): boolean
    • getRegisteredServiceCount(): int
  3. ConnectionPoolChartService

    • isDruidMetrics(ConnectionPoolMetrics m): boolean
    • generateTransactionHistogram(long[] ranges, long[] values): Map<String,Long>
    • generateSqlExecutionHistogram(List<SqlExecutionEntry> records): Map<String,Integer>

These endpoints and services will allow the Console to poll metrics, render dynamic charts, and push configuration updates back to the connected microservices.

Other related information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions