Repository navigation
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
Not exactly a logic or performance issue. However, the current approach has several drawbacks:
- Typos in log key strings can silently break log search, filtering, and alerting.
- There is no single source of truth for available structured log keys.
- Logging relies on hardcoded strings, creating inconsistency with the event system, which already uses constants.
- Using raw strings prevents IDE features such as autocomplete, rename refactoring, and find-all-references, making maintenance more difficult.
Describe the solution you'd like
Introduce a centralized constants class for structured log keys, similar to how event constants are already defined:
public final class LogKeys {
public static final String TABLE_IDENTIFIER = "tableIdentifier";
public static final String METADATA_LOCATION = "metadataLocation";
public static final String TABLE_LOCATIONS = "tableLocations";
public static final String NAMESPACE = "namespace";
public static final String VIEW_IDENTIFIER = "viewIdentifier";
// ...
}Then replace hardcoded string literals in addKeyValue() calls with the corresponding constants.
Before
LOGGER.atWarn()
.addKeyValue("tableIdentifier", tableIdentifier)
.log("...");After
LOGGER.atWarn()
.addKeyValue(LogKeys.TABLE_IDENTIFIER, tableIdentifier)
.log("...");Scope
- Refactor approximately 102
addKeyValue()call sites acrossruntime/service/andpolaris-core/. - Consolidate approximately 30 distinct structured log key names into a single constants class.
- No functional or behavioral changes; this is a refactoring focused on improving consistency, maintainability, and IDE support.
Describe alternatives you've considered
No response
Additional context
Questions for the community
- Would this be a pattern the project is interested in adopting?
- Where would you prefer these constants to live—
polaris-core(for shared reuse) orruntime/service(closer to where they're consumed)? - Do you have any preference for the class name or its location?
If there's interest, I'd be happy to put together an implementation.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
Introduce StructuredLogKeys constants for SLF4J addKeyValue calls (ap…