GitHub user nickwallen opened a pull request:
https://github.com/apache/metron/pull/1202
METRON-1782 Add Kafka Partition and Offset to Profiler Debug Logs
I was troubleshooting an issue that a user was running into with the
Profiler. The logs made it appear that a second batch of messages were being
sent after a period of time, when none actually were.
We found that the second batch was actually just Storm timing out the first
batch of messages and re-sending them. This would have been simple to uncover
if we had the Kafka topic, partition, and offset details of each message logged
at a DEBUG level.
I made those code change while debugging the issue. I thought this might
be generally useful to roll into Apache.
## Testing
1. Build Metron (this excludes building the UI code to save time.)
```
mvn clean install -DskipTests -T2C -pl
'!metron-interface/metron-config,!metron-interface/metron-alerts'
```
1. Alter
`metron-analytics/metron-profilers/src/test/resources/log4j.properties` and
uncomment the lines to turn on DEBUG logs for the Profiler.
```
# uncomment below to help debug tests
log4j.logger.org.apache.metron.profiler=ALL
log4j.logger.org.apache.storm.windowing=ALL
```
1. Run the `ProfilerIntegrationTest` and review the log messages. You
should see a message like this.
```
cd metron-analytics/metron-profiler
mvn integration-test
```
1. You should see log messages like the following. This shows us exactly
which messages from the topic are being processed.
```
DEBUG ProfileSplitterBolt:151 - Received message; topic=indexing,
partition=0, offset=0, kafkaTimestamp=1537276089966
...
DEBUG ProfileSplitterBolt:151 - Received message; topic=indexing,
partition=0, offset=1, kafkaTimestamp=1537276090197
...
DEBUG ProfileSplitterBolt:151 - Received message; topic=indexing,
partition=0, offset=2, kafkaTimestamp=1537276090405
```
## Pull Request Checklist
- [ ] Is there a JIRA ticket associated with this PR? If not one needs to
be created at [Metron
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [ ] Does your PR title start with METRON-XXXX where XXXX is the JIRA
number you are trying to resolve? Pay particular attention to the hyphen "-"
character.
- [ ] Has your PR been rebased against the latest commit within the target
branch (typically master)?
- [ ] Have you included steps to reproduce the behavior or problem that is
being changed or addressed?
- [ ] Have you included steps or a guide to how the change may be verified
and tested manually?
- [ ] Have you ensured that the full suite of tests and checks have been
executed in the root metron folder via:
- [ ] Have you written or updated unit tests and or integration tests to
verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] Have you verified the basic functionality of the build by building
and running locally with Vagrant full-dev environment or the equivalent?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nickwallen/metron PROFILER-LOG-OFFSETS
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/1202.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1202
----
commit c73b27572bf5f60d283e066f1683ef2f9fb6979c
Author: Nick Allen <nick@...>
Date: 2018-09-17T18:32:43Z
Profiler able to log topic, partition, offset, timestamp of messages which
helps debug if/when messages are replayed
commit 4bc728e9d9fbbcf0311a5a2a60e510fd844b37dc
Author: Nick Allen <nick@...>
Date: 2018-09-18T00:10:31Z
Fix-up the unit test
----
---