exceptionfactory commented on code in PR #89:
URL: https://github.com/apache/nifi-api/pull/89#discussion_r3327565299


##########
src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java:
##########
@@ -111,4 +113,31 @@ default void updateFlow(FlowContext flowContext, 
VersionedExternalFlow versioned
      */
     void updateFlow(FlowContext flowContext, VersionedExternalFlow 
versionedExternalFlow, BundleCompatibility bundleCompatability) throws 
FlowUpdateException;
 
+    /**
+     * <p>
+     *     Sets custom logging attributes that the framework will include in 
the SLF4J {@code MDC} for every log line emitted
+     *     by the Connector and by any component (Processor, Controller 
Service, etc.) running inside the Connector's managed
+     *     flow. The given map replaces any previously set custom attributes.
+     * </p>
+     *
+     * <p>
+     *     The framework reserves a set of well-known keys that describe the 
Connector itself (identity, bundle coordinate,
+     *     etc.). Any entry in {@code attributes} whose key collides with a 
reserved framework-managed key is dropped and a
+     *     warning is logged for that entry; the remaining entries are 
accepted.
+     * </p>
+     *
+     * <p>
+     *     This method is intended to be called during or after {@link 
Connector#initialize(ConnectorInitializationContext)
+     *     initialization}, for example once configuration has been applied 
and the Connector has values it wishes to surface
+     *     (e.g. database name, source schema). It is safe to call repeatedly; 
each call replaces the prior set of custom
+     *     attributes.
+     * </p>
+     *
+     * @param attributes the custom attributes to expose on logs from this 
Connector and its managed flow; must not be {@code null}
+     * @throws UnsupportedOperationException if the runtime implementation 
does not support custom logging attributes
+     */
+    default void setLoggingAttributes(Map<String, String> attributes) {

Review Comment:
   This method is very open-ended, and moves in a different direction from the 
current framework-controlled Logging Attributes in a Process Group. Rather than 
exposing it as a point of extension, it seems better to maintain a strategy of 
declared properties, which the framework handles for inclusion.



##########
src/main/java/org/apache/nifi/components/connector/AbstractConnector.java:
##########
@@ -92,7 +92,6 @@ protected final ConnectorInitializationContext 
getInitializationContext() {
         if (initializationContext == null) {
             throw new IllegalStateException("Connector has not been 
initialized");
         }
-

Review Comment:
   This change appears unnecessary



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to