-
Notifications
You must be signed in to change notification settings - Fork 100
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
[SNOW-594195] Add correlationId to logging #487
Conversation
apologies, this really should have been multiple prs. I've highlighted the important parts |
Codecov Report
@@ Coverage Diff @@
## master #487 +/- ##
==========================================
+ Coverage 87.07% 87.19% +0.12%
==========================================
Files 46 47 +1
Lines 3946 3953 +7
Branches 416 419 +3
==========================================
+ Hits 3436 3447 +11
+ Misses 350 344 -6
- Partials 160 162 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Confirmed that loggers created without a correlationId eventually log messages with a correlationId.
|
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.
I'm not sure only adding the id at instance level would be sufficient, but this is a good start! We could add more things over time.
src/main/java/com/snowflake/kafka/connector/SnowflakeSinkConnector.java
Outdated
Show resolved
Hide resolved
src/main/java/com/snowflake/kafka/connector/SnowflakeSinkConnectorConfig.java
Outdated
Show resolved
Hide resolved
src/main/java/com/snowflake/kafka/connector/internal/LoggerHandler.java
Outdated
Show resolved
Hide resolved
Please also add a PR description about what we're trying to do here |
d248a11
to
60baf2b
Compare
src/test/java/com/snowflake/kafka/connector/internal/LoggerHandlerTest.java
Outdated
Show resolved
Hide resolved
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.
LGTM, thanks! Regarding the testing, it would be good to use Mockito or Powermock, but I'm fine with some simple test cases.
src/test/java/com/snowflake/kafka/connector/internal/LoggerHandlerTest.java
Outdated
Show resolved
Hide resolved
src/main/java/com/snowflake/kafka/connector/SnowflakeSinkTask.java
Outdated
Show resolved
Hide resolved
src/main/java/com/snowflake/kafka/connector/internal/EnableLogging.java
Outdated
Show resolved
Hide resolved
src/main/java/com/snowflake/kafka/connector/internal/LoggerHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/com/snowflake/kafka/connector/internal/LoggerHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/com/snowflake/kafka/connector/internal/LoggerHandler.java
Outdated
Show resolved
Hide resolved
Should there be an extra space |
src/main/java/com/snowflake/kafka/connector/internal/LoggerHandler.java
Outdated
Show resolved
Hide resolved
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.
overall looks great. Thanks Revi! Will wait for your comments. [No major concerns]
Can we somehow also get this correlation id in our telemetry so that we can check uuid in snowhouse? Dont need to do this in this PR but lets track it. |
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.
lgtm, thanks for adding tests! Looks complete.
Lets make sure the gfmt passes before you merge.
* Add docker setup resources to the kafka connect repo (#483) * initial docker setup info * blank connectors and rename container folder * ignore connector example json files * more .gitignore setup maybe? * example files * template folder * clean up misc * remove volume bind, allow install sfkc 1.8.1 * yml changes * remove empty lines * Fix docker-setup yml files (#490) * docker wont pull from /usr/ * git ignore test * readme * test gitignore * remove yml files from gitignore * test force add * i think gitignore works now * need to add it back in for changes lol * add back jmx * SNOW-625820: multiple fixes for KC schematization schema mapping (#488) - Update the config key word from enable.schematization to snowflake.enable.schematization - Remove some duplicate constants - Fix a null pointer exception during channel closing - Update the column name format function to return the quoted column name * [SNOW-594195] Add correlationId to logging (#487) * smh static doesnt work * logginghandler with static cid, logging -> enablelogging * test gitignore * passes tests * corrid at beginning * remove yml files from git cache * add yml, copyright; change logger class name * ran formatter * remove wildcard imports * added logging handler tests * review changes * formatter * NO-SNOW: Put rows with JsonProcessingException into the DLQ instead of ignoring them (#491) Put rows with JsonProcessingException into the DLQ instead of ignoring them * [SNOW-643653] Fix Citi Blackduck vulnerabilities (#497) * avro 1.8.1 -> 1.11.0, kakfa-clients -> 2.8.2 * vulnerabilities fixed? * fixed all vuln * [SNOW-665920] Add warnings in build script to prevent a privately built jar from going to the customer (#492) * do as i say not as i do * change warn and mkdir docker jar folder * [SNOW-665898] Add log granularity instance id logging for Task (#495) * refactor to kcglobalinstanceid * parse instance id * ut pass - til final doesnt let injectmocks * tests pass, need cc * cc 100 * added logging to task * spacing issue in logs * formatter * formatter and rerun failed tests? * set task instance id in start * utils string format * task functionality * can someone say overengineer oops * no one likes overenegineering * 100 cc * added int test, maybe need to merge other branch? * remove fallbackid.. weird and not needed for task * working on int test * added it * stash * it done * formatter * formatter again * remove start count and fix it * format * add open count and some pr nits * formatting is a pain * change starttime and import * use uuid+time for instanceid * Modify Codeowners (#494) * SNOW-630885: Support schema evolution with schematization (#501) This PR adds support to do schema evolution through ALTER TABLE command when there is schema mismatch between the kafka message and the table schema * Bump protobuf-java from 3.19.4 to 3.19.6 in /test/test_data/protobuf (#499) Bumps [protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.19.4 to 3.19.6. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/generate_changelog.py) - [Commits](protocolbuffers/protobuf@v3.19.4...v3.19.6) --- updated-dependencies: - dependency-name: com.google.protobuf:protobuf-java dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * SNOW-686528: Check schema evolution table option (#509) - We always enable schema evolution for tables that are created by KC - Check for schema evolution table option before updating the schema * SNOW-506446: [Snyk] Security upgrade com.fasterxml.jackson.core:jackson-databind from 2.13.2.1 to 2.13.4.2 (#503) * fix: pom.xml to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JAVA-COMFASTERXMLJACKSONCORE-3038426 * added to confluent pom as well Co-authored-by: snyk-bot <snyk-bot@snyk.io> Co-authored-by: revi cheng <revi.cheng@snowflake.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Toby Zhang <toby.zhang@snowflake.com> Co-authored-by: Jay Patel <jay.patel@snowflake.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: sfc-gh-snyk-sca-sa <95290361+sfc-gh-snyk-sca-sa@users.noreply.github.com> Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Problem: multiple instances of kafka connect log to same spot causing confusion during debugging. Issue came up during a the Fidelity issue linked in the jira.
Changes:
LoggingHandler
Logging.java -> EnableLogging.java
Logging.logMessage() -> Utils.formatLogMessage()