-
Notifications
You must be signed in to change notification settings - Fork 107
#137 - Handle sticky session expiration #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| if (channelEvents.get(resp.getAckId()) != null) { | ||
| log.error("ackId={} already exists for channel={} index={}", resp.getAckId(), channel, channel.getIndexer()); | ||
| log.warn("ackId={} already exists for channel={} index={}, possible duplication of data", resp.getAckId(), channel, channel.getIndexer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify to
log.warn("ackId={} already exists for channel={} index={} data may be duplicated in Splunk", resp.getAckId(), channel, channel.getIndexer());
| return ackPollInterval; | ||
| } | ||
|
|
||
| public void stickySessionHandler(HecChannel channel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include JavaDocs for new method
/**
* StickySessionHandler is .... It is used to ..
*
* @param channel "channel is ...
* @see HecChannel
* @since 1.1.0
*/
| ConcurrentHashMap<Long, EventBatch> channelBatches = outstandingEventBatches.get(channel); | ||
| // Remove batches for the channel from the poller | ||
| if(channelBatches != null && channelBatches.size() > 0) { | ||
| totalOutstandingEventBatches.addAndGet(-channelBatches.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly use getAndDecrement() after each batch.fail instead of larger subtraction of totalOutstandingEventBatches to ensure correctness in value at all times.
| batch.fail(); | ||
| expired.add(batch); | ||
| iter.remove(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include log lines indicated - Found x batches marked for failure
- Sucessfully failed x batches
| if(resp.equals("sticky_session_expired")) { | ||
| stickySessionHandler(channel); | ||
| } else { | ||
| try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to nest the try catch. move it out to capture
String resp = channel.executeHttpRequest(request);
and
stickySessionHandler(channel);
|
|
||
| public void setId() { id = newChannelId(); } | ||
|
|
||
| public void setAvailable(boolean _isAvailable) { isAvailable = _isAvailable; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to
public void setAvailable(boolean isAvailable) { this.isAvailable = isAvailable; }
| log.debug("sent {} events to splunk through channel={} indexer={}", | ||
| batch.size(), channel.getId(), getBaseUrl()); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra line
dtregonning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for PR Chaitanya.
Please address comments in review and validate duplicate testing for current release and PR are equal or better.
cbf4c56 to
17adf42
Compare
| } else if (resp.equals(noDataError)) { | ||
| return createResponse(resp, 400); | ||
| } else { | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space
| } | ||
|
|
||
| // log.info("event posting, channel={}, cookies={}", channel, resp.getHeaders("Set-Cookie")); | ||
| // log.info("event posting, channel={}, cookies={}, cookies.length={}", channel, resp.getHeaders("Set-Cookie"), resp.getHeaders("Set-Cookie").length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
realign // in comment
| // Set channel unavailable | ||
| channel.setAvailable(false); | ||
| log.info("Channel {} set to be not available", oldChannelId); | ||
| // Get batches for the channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move single line comments to "flow description" in java docs
| return; | ||
| } | ||
| handleAckPollResult(channel, ackPollResult); | ||
| if (ackPollResult != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look for more graceful way of handling null response. use exception handling or remove if not needed
17adf42 to
33306e8
Compare
dtregonning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for PR - all work looks good.
No description provided.