You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "ZephyrYWZhou (via GitHub)" <gi...@apache.org> on 2026/07/10 21:45:46 UTC
[I] Introduce structured log key constants for SLF4J addKeyValue calls [polaris]
ZephyrYWZhou opened a new issue, #5033:
URL: https://github.com/apache/polaris/issues/5033
### 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:
```java
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**
```java
LOGGER.atWarn()
.addKeyValue("tableIdentifier", tableIdentifier)
.log("...");
```
**After**
```java
LOGGER.atWarn()
.addKeyValue(LogKeys.TABLE_IDENTIFIER, tableIdentifier)
.log("...");
```
### Scope
* Refactor approximately 102 `addKeyValue()` call sites across `runtime/service/` and `polaris-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) or `runtime/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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Introduce structured log key constants for SLF4J addKeyValue calls [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra closed issue #5033: Introduce structured log key constants for SLF4J addKeyValue calls
URL: https://github.com/apache/polaris/issues/5033
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org