Skip to content
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

Add SASL/SCRAM authentication mechanism on kafka receiver and exporter #2503

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

altieresfreitas
Copy link
Contributor

Description:
This PR adds SASL/SCRAM authentication to kafka receiver and exporter.

Link to tracking Issue:
#2252

Testing:
Unit Tests

Documentation:
Added to Readme

@jpkrohling
Copy link
Member

jpkrohling commented Feb 17, 2021

Before reviewing this, isn't this in conflict with your other PR, #2322?

Sorry, I should have read the newest comments on the linked PR... I'll take a look soon.

@jpkrohling jpkrohling self-assigned this Feb 17, 2021
@jpkrohling jpkrohling self-requested a review February 17, 2021 08:07
@jpkrohling
Copy link
Member

The same test seems to have failed, but I doubt this test alone would be the culprit.

These are the results for the current main branch:

Test                                    |Result|Duration|CPU Avg%|CPU Max%|RAM Avg MiB|RAM Max MiB|Sent Items|Received Items|
----------------------------------------|------|-------:|-------:|-------:|----------:|----------:|---------:|-------------:|
TraceNoBackend10kSPS/NoMemoryLimit      |PASS  |     15s|    28.3|    32.3|        108|        149|    148190|             0|
TraceNoBackend10kSPS/MemoryLimit        |PASS  |     15s|    30.9|    32.3|         57|         69|    146890|             0|
Trace1kSPSWithAttrs/0*0bytes            |PASS  |     15s|     6.9|     8.0|         49|         60|     14990|         14990|
Trace1kSPSWithAttrs/100*50bytes         |PASS  |     15s|    35.6|    36.0|         55|         66|     14990|         14990|
Trace1kSPSWithAttrs/10*1000bytes        |PASS  |     15s|    14.7|    15.7|         51|         62|     14990|         14990|
Trace1kSPSWithAttrs/20*5000bytes        |PASS  |     15s|    46.4|    47.0|         60|         74|     14990|         14990|

And here are the results for this PR:

Test                                    |Result|Duration|CPU Avg%|CPU Max%|RAM Avg MiB|RAM Max MiB|Sent Items|Received Items|
----------------------------------------|------|-------:|-------:|-------:|----------:|----------:|---------:|-------------:|
TraceNoBackend10kSPS/NoMemoryLimit      |FAIL  |     12s|    35.0|    37.3|         98|        151|    119180|             0|RAM consumption is 151 MiB, max expected is 150 MiB
TraceNoBackend10kSPS/MemoryLimit        |PASS  |     15s|    33.8|    35.7|         58|         70|    145600|             0|
Trace1kSPSWithAttrs/0*0bytes            |PASS  |     15s|     8.1|     8.7|         52|         60|     14990|         14990|
Trace1kSPSWithAttrs/100*50bytes         |PASS  |     15s|    32.2|    32.7|         54|         66|     14990|         14990|
Trace1kSPSWithAttrs/10*1000bytes        |PASS  |     15s|    14.5|    15.3|         52|         63|     14990|         14990|
Trace1kSPSWithAttrs/20*5000bytes        |PASS  |     15s|    42.9|    43.3|         59|         73|     14990|         14990|

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One improvement could be checking that both the username and password are set.

exporter/kafkaexporter/authentication.go Show resolved Hide resolved
@altieresfreitas altieresfreitas force-pushed the kafka_scram branch 2 times, most recently from 3a72fb3 to 8906b09 Compare February 17, 2021 15:52
@altieresfreitas
Copy link
Contributor Author

The same test seems to have failed, but I doubt this test alone would be the culprit.

These are the results for the current main branch:

Test                                    |Result|Duration|CPU Avg%|CPU Max%|RAM Avg MiB|RAM Max MiB|Sent Items|Received Items|
----------------------------------------|------|-------:|-------:|-------:|----------:|----------:|---------:|-------------:|
TraceNoBackend10kSPS/NoMemoryLimit      |PASS  |     15s|    28.3|    32.3|        108|        149|    148190|             0|
TraceNoBackend10kSPS/MemoryLimit        |PASS  |     15s|    30.9|    32.3|         57|         69|    146890|             0|
Trace1kSPSWithAttrs/0*0bytes            |PASS  |     15s|     6.9|     8.0|         49|         60|     14990|         14990|
Trace1kSPSWithAttrs/100*50bytes         |PASS  |     15s|    35.6|    36.0|         55|         66|     14990|         14990|
Trace1kSPSWithAttrs/10*1000bytes        |PASS  |     15s|    14.7|    15.7|         51|         62|     14990|         14990|
Trace1kSPSWithAttrs/20*5000bytes        |PASS  |     15s|    46.4|    47.0|         60|         74|     14990|         14990|

And here are the results for this PR:

Test                                    |Result|Duration|CPU Avg%|CPU Max%|RAM Avg MiB|RAM Max MiB|Sent Items|Received Items|
----------------------------------------|------|-------:|-------:|-------:|----------:|----------:|---------:|-------------:|
TraceNoBackend10kSPS/NoMemoryLimit      |FAIL  |     12s|    35.0|    37.3|         98|        151|    119180|             0|RAM consumption is 151 MiB, max expected is 150 MiB
TraceNoBackend10kSPS/MemoryLimit        |PASS  |     15s|    33.8|    35.7|         58|         70|    145600|             0|
Trace1kSPSWithAttrs/0*0bytes            |PASS  |     15s|     8.1|     8.7|         52|         60|     14990|         14990|
Trace1kSPSWithAttrs/100*50bytes         |PASS  |     15s|    32.2|    32.7|         54|         66|     14990|         14990|
Trace1kSPSWithAttrs/10*1000bytes        |PASS  |     15s|    14.5|    15.3|         52|         63|     14990|         14990|
Trace1kSPSWithAttrs/20*5000bytes        |PASS  |     15s|    42.9|    43.3|         59|         73|     14990|         14990|

Probably some transient failure here.

The result for the same PR.

Started: Wed, 17 Feb 2021 c16:00:45 +0000

Test Result Duration CPU Avg% CPU Max% RAM Avg MiB RAM Max MiB Sent Items Received Items
TraceNoBackend10kSPS/NoMemoryLimit PASS 15s 27.3 31.0 109 150 148010 0
TraceNoBackend10kSPS/MemoryLimit PASS 15s 31.0 32.0 57 69 145700 0
Trace1kSPSWithAttrs/0*0bytes PASS 15s 6.7 8.3 52 63 14990 14990
Trace1kSPSWithAttrs/100*50bytes PASS 15s 34.1 35.7 54 65 14990 14990
Trace1kSPSWithAttrs/10*1000bytes PASS 15s 14.5 15.0 53 64 14990 14990
Trace1kSPSWithAttrs/20*5000bytes PASS 15s 44.6 46.3 60 75 14990 14990

@altieresfreitas
Copy link
Contributor Author

@bogdandrutu, can you take a look at this PR, please?
This is related to #2322

Thanks

@codecov
Copy link

codecov bot commented Feb 18, 2021

Codecov Report

Merging #2503 (6b25ed1) into main (846b971) will decrease coverage by 0.04%.
The diff coverage is 68.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2503      +/-   ##
==========================================
- Coverage   91.76%   91.71%   -0.05%     
==========================================
  Files         266      267       +1     
  Lines       15111    15140      +29     
==========================================
+ Hits        13866    13886      +20     
- Misses        866      874       +8     
- Partials      379      380       +1     
Impacted Files Coverage Δ
exporter/kafkaexporter/scram_client.go 0.00% <0.00%> (ø)
exporter/kafkaexporter/authentication.go 96.07% <90.90%> (-3.93%) ⬇️
testutil/testutil.go 81.60% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 846b971...6b25ed1. Read the comment docs.

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be merged. I have only one minor comment about an error message, but it's in no way blocking the merge.

exporter/kafkaexporter/authentication.go Outdated Show resolved Hide resolved
@tigrannajaryan
Copy link
Member

@bogdandrutu do you plan to review this or good to merge?

@altieresfreitas altieresfreitas force-pushed the kafka_scram branch 8 times, most recently from 16f086e to e792973 Compare February 18, 2021 21:50
Fix godoc comment to better explain struct proposal
Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de>

Fix return error message format
Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de>

Fix Typo on test comment
Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de>

Add username and password validation to prevent empty values
Add specific error message on username and password validation
Copy link
Member

@gramidt gramidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@jpkrohling
Copy link
Member

@tigrannajaryan would you please merge this one?

@bogdandrutu bogdandrutu merged commit 49d0b61 into open-telemetry:main Feb 23, 2021
This was referenced Mar 15, 2021
@Neustradamus
Copy link

@altieresfreitas and all others: Thanks a lot for all about SCRAM.

Linked to:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants