Skip to content

Conversation

@ramonskie
Copy link
Contributor

Summary

This PR comprehensively fixes the root causes reported in issue #1152, affecting not just PostgreSQL but 6 additional frameworks.

Supersedes: #1153 (provides more comprehensive fix)
Fixes: #1152

Problem

Service detection was broken in two ways:

  1. HasServiceByNamePattern() only searched "user-provided" services, missing broker-provided services
  2. Service label/tag matching was case-sensitive, failing for casing variations

Solution

Core Library Fixes (src/java/common/context.go)

  • HasService() - Now case-insensitive, iterates all service labels (affects 19+ frameworks automatically)
  • HasTag() - Now case-insensitive tag comparison (affects 19+ frameworks automatically)
  • HasServiceByNamePattern() - Now searches ALL service labels, not just "user-provided" (affects 19+ frameworks automatically)

Framework-Specific Fixes (6 frameworks)

Standardized to use common.ContainsIgnoreCase() helper:

  • PostgreSQL JDBC
  • MariaDB JDBC
  • Elastic APM Agent
  • Luna Security Provider
  • ProtectApp Security Provider
  • Seeker Security Provider

Testing

  • ✅ All packages build successfully
  • ✅ No compilation errors
  • ✅ Consistent pattern across all frameworks

Impact

  • 25+ frameworks now have more robust service detection
  • Single fix point for case-insensitive matching
  • Eliminates code duplication
  • More robust for various service broker conventions

This comprehensive fix addresses root causes reported in issue #1152,
affecting not just PostgreSQL but 6 additional frameworks.

CORE LIBRARY FIXES (src/java/common/context.go):

1. HasService() - Now case-insensitive
   - Handles service label variations (PostgreSQL vs postgresql)
   - Affects 19+ frameworks automatically

2. HasTag() - Now case-insensitive
   - Handles tag casing variations across service brokers
   - Affects 19+ frameworks automatically

3. HasServiceByNamePattern() - Now searches ALL service labels
   - Fixes broker-provided service detection (postgresql, mysql, etc.)
   - Was limited to 'user-provided' only
   - Affects 19+ frameworks automatically

FRAMEWORK-SPECIFIC FIXES:

4. PostgreSQL JDBC - Use centralized ContainsIgnoreCase helper
5. MariaDB JDBC - Use centralized ContainsIgnoreCase helper
6. Elastic APM Agent - Simplified detection logic, use helpers consistently
7. Luna Security Provider - Use centralized ContainsIgnoreCase helper
8. ProtectApp Security Provider - Use centralized ContainsIgnoreCase helper
9. Seeker Security Provider - Use centralized ContainsIgnoreCase helper

BENEFITS:
- Single fix point for case-insensitive matching
- Consistent behavior across all 25+ frameworks
- Eliminates code duplication
- More robust detection for various service broker conventions

Supersedes PR #1153 with comprehensive systemic fix.

Fixes #1152
@kiril-keranov
Copy link
Contributor

@ramonskie great to have adjusted the frameworks service detection!

@ramonskie ramonskie merged commit d6dcf16 into feature/go-migration Jan 23, 2026
1 check passed
@ramonskie ramonskie deleted the fix-systemic-service-detection branch January 23, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants