Skip to content

[AI-8th] add SofaDiagnosticEndpoint for runtime diagnostics#1411

Open
kuleat wants to merge 8 commits intosofastack:masterfrom
kuleat:feature/sofa-diagnostic-endpoint
Open

[AI-8th] add SofaDiagnosticEndpoint for runtime diagnostics#1411
kuleat wants to merge 8 commits intosofastack:masterfrom
kuleat:feature/sofa-diagnostic-endpoint

Conversation

@kuleat
Copy link
Copy Markdown

@kuleat kuleat commented Apr 3, 2026

#1406

Summary

Add a new Actuator endpoint, /actuator/sofa-diagnostic, for runtime diagnostics in SOFABoot applications.

Read Operations

  • GET /sofa-diagnostic - returns a summary of component statistics, thread pool metrics, JVM information,
    and memory usage
  • GET /sofa-diagnostic/services/{type} - lists published, referenced, or all SOFA services
  • GET /sofa-diagnostic/serviceDetail/{interfaceId} - returns detailed information for a specific service
    interface

@sofastack-cla
Copy link
Copy Markdown

sofastack-cla Bot commented Apr 3, 2026

Hi @kuleat, welcome to SOFAStack community, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

@nobodyiam
Copy link
Copy Markdown
Member

nobodyiam commented Apr 4, 2026

Thanks for the contribution!

This looks like a significant new feature. CI is currently reporting failures; please fix any broken tests or formatting issues before requesting review.

@sofastack-cla sofastack-cla Bot added cla:yes and removed cla:no labels Apr 6, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 88.78505% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.04%. Comparing base (459b02f) to head (57479a3).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ot/actuator/diagnostic/SofaDiagnosticEndpoint.java 88.57% 6 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1411      +/-   ##
============================================
+ Coverage     82.94%   83.04%   +0.10%     
- Complexity     2975     3007      +32     
============================================
  Files           340      342       +2     
  Lines          9833     9940     +107     
  Branches       1178     1183       +5     
============================================
+ Hits           8156     8255      +99     
- Misses         1163     1167       +4     
- Partials        514      518       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new SOFABoot Actuator endpoint, /actuator/sofa-diagnostic, intended to provide runtime diagnostics (components/services/thread pools/JVM/memory) plus operational commands (GC, thread dump, heap dump, cache clearing, component refresh), along with auto-configuration and smoke/unit tests.

Changes:

  • Added SofaDiagnosticEndpoint with read/write operations for runtime diagnostics and maintenance commands.
  • Added actuator auto-configuration for the endpoint and a Spring Security auto-configuration intended to protect it (plus related “Isle” sharing filter updates).
  • Added unit and smoke tests covering endpoint output and security scenarios; updated smoke-test dependencies to include Spring Security.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sofa-boot-tests/sofa-boot-smoke-tests/sofa-boot-smoke-tests-actuator/src/test/java/com/alipay/sofa/smoke/tests/actuator/security/SofaDiagnosticSecurityTests.java Smoke tests for default (authenticated) access behavior.
sofa-boot-tests/sofa-boot-smoke-tests/sofa-boot-smoke-tests-actuator/src/test/java/com/alipay/sofa/smoke/tests/actuator/security/SofaDiagnosticSecurityPermitAllTests.java Smoke tests for sensitive=false behavior (permit-all).
sofa-boot-tests/sofa-boot-smoke-tests/sofa-boot-smoke-tests-actuator/src/test/java/com/alipay/sofa/smoke/tests/actuator/security/SofaDiagnosticSecurityBasePathTests.java Smoke tests for custom actuator base-path behavior.
sofa-boot-tests/sofa-boot-smoke-tests/sofa-boot-smoke-tests-actuator/src/test/java/com/alipay/sofa/smoke/tests/actuator/security/SofaDiagnosticSecurityBackoffTests.java Smoke tests ensuring security auto-config backs off when user supplies a chain.
sofa-boot-tests/sofa-boot-smoke-tests/sofa-boot-smoke-tests-actuator/src/test/java/com/alipay/sofa/smoke/tests/actuator/diagnostic/SofaDiagnosticEndpointWebTests.java End-to-end endpoint response and command tests (GC/thread dump/heap dump).
sofa-boot-tests/sofa-boot-smoke-tests/sofa-boot-smoke-tests-actuator/pom.xml Adds spring-boot-starter-security for smoke tests.
sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/context/processor/SofaPostProcessorShareManagerTests.java Adds tests for bean-name-based skip-sharing filter behavior.
sofa-boot-project/sofa-boot/src/main/java/com/alipay/sofa/boot/constant/SofaBootConstants.java Extends default actuator web exposure list to include sofa-diagnostic.
sofa-boot-project/sofa-boot-autoconfigure/src/test/java/org/springframework/security/config/annotation/web/configuration/FakeSecurityBeanFactoryPostProcessor.java Test helper type to validate Spring Security post-processor filtering.
sofa-boot-project/sofa-boot-autoconfigure/src/test/java/com/alipay/sofa/boot/autoconfigure/isle/SofaModuleAutoConfigurationTests.java Tests that Spring Security post-processors are not shared into module contexts.
sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/isle/SofaModuleAutoConfiguration.java Adds a SofaPostProcessorShareFilter bean to skip Spring Security post-processors.
sofa-boot-project/sofa-boot-actuator/src/test/java/com/alipay/sofa/boot/actuator/diagnostic/SofaDiagnosticEndpointTests.java Unit tests for endpoint summary, service queries, and write operations.
sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/diagnostic/SofaDiagnosticEndpoint.java New diagnostic endpoint implementation (read + write operations).
sofa-boot-project/sofa-boot-actuator-autoconfigure/src/test/java/com/alipay/sofa/boot/actuator/autoconfigure/diagnostic/SofaDiagnosticEndpointAutoConfigurationTests.java Tests for endpoint auto-configuration conditions.
sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports Registers the new diagnostic endpoint + security auto-configurations.
sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/diagnostic/SofaDiagnosticSecurityProperties.java New properties for sensitive flag controlling access behavior.
sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/diagnostic/SofaDiagnosticSecurityAutoConfiguration.java New security auto-config intended to protect sofa-diagnostic.
sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/diagnostic/SofaDiagnosticEndpointAutoConfiguration.java Endpoint auto-config with conditional bean creation based on sensitive and Security presence.
sofa-boot-project/sofa-boot-actuator-autoconfigure/pom.xml Adds optional Spring Security dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CrazyHZM
Copy link
Copy Markdown
Member

@kuleat please handle the Copilot's comments first.

@kuleat
Copy link
Copy Markdown
Author

kuleat commented Apr 24, 2026

@kuleat please handle the Copilot's comments first.

@CrazyHZM Thanks, I’ve addressed Copilot’s comments. PTAL.

@CrazyHZM
Copy link
Copy Markdown
Member

@kuleat I think these write operations are not necessary for the time being.

@sofastack-cla sofastack-cla Bot added size/XL and removed size/XXL labels Apr 27, 2026
@kuleat
Copy link
Copy Markdown
Author

kuleat commented Apr 27, 2026

@kuleat I think these write operations are not necessary for the time being.

Addressed, thanks. Removed the write operations.

@kuleat kuleat requested a review from CrazyHZM April 30, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants