-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change datafeed req logging, change receiptId format, fix gh-4695
- Loading branch information
Showing
45 changed files
with
667 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
stroom-core/src/main/java/stroom/core/receive/StroomReceiptIdGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package stroom.core.receive; | ||
|
||
import stroom.node.api.NodeInfo; | ||
import stroom.receive.common.ReceiptIdGenerator; | ||
import stroom.util.NullSafe; | ||
import stroom.util.concurrent.UniqueId; | ||
import stroom.util.concurrent.UniqueId.NodeType; | ||
import stroom.util.concurrent.UniqueIdGenerator; | ||
import stroom.util.logging.LambdaLogger; | ||
import stroom.util.logging.LambdaLoggerFactory; | ||
|
||
import jakarta.inject.Inject; | ||
import jakarta.inject.Singleton; | ||
|
||
import java.util.Objects; | ||
|
||
@Singleton | ||
public class StroomReceiptIdGenerator implements ReceiptIdGenerator { | ||
|
||
private static final LambdaLogger LOGGER = LambdaLoggerFactory.getLogger(StroomReceiptIdGenerator.class); | ||
private static final String UNSAFE_CHARS_REGEX = "[^A-Za-z0-9-]"; | ||
|
||
private static final NodeType NODE_TYPE = NodeType.STROOM; | ||
|
||
private final UniqueIdGenerator uniqueIdGenerator; | ||
|
||
private final String nodeId; | ||
|
||
@Inject | ||
public StroomReceiptIdGenerator(final NodeInfo nodeInfo) { | ||
final String nodeName = nodeInfo.getThisNodeName(); | ||
if (NullSafe.isBlankString(nodeName)) { | ||
throw new IllegalArgumentException("nodeName is blank"); | ||
} | ||
this.nodeId = createSafeString(nodeName); | ||
if (!Objects.equals(nodeName, nodeId)) { | ||
LOGGER.info("Using nodeId '{}' for receiptId meta attribute as derived from nodeName '{}'", | ||
nodeId, nodeName); | ||
} | ||
this.uniqueIdGenerator = new UniqueIdGenerator(NODE_TYPE, nodeId); | ||
} | ||
|
||
@Override | ||
public UniqueId generateId() { | ||
return uniqueIdGenerator.generateId(); | ||
} | ||
|
||
static String createSafeString(final String in) { | ||
if (in == null) { | ||
return null; | ||
} else { | ||
return in.replaceAll(UNSAFE_CHARS_REGEX, "-"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,6 +186,7 @@ proxyConfig: | |
logStream: | ||
metaKeys: | ||
- "guid" | ||
- "receiptid" | ||
- "feed" | ||
- "system" | ||
- "environment" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
stroom-proxy/stroom-proxy-app/src/main/java/stroom/proxy/app/event/EventConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.