-
Notifications
You must be signed in to change notification settings - Fork 93
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
SONARPY-2457 Collect data for the Python version #2252
Conversation
67270df
to
3823b50
Compare
7410262
to
7fdb403
Compare
a5e68b5
to
bf32141
Compare
2e3fc3d
to
832ad9d
Compare
bf32141
to
d7f764c
Compare
9f01657
to
c7c3bc3
Compare
26eebf3
to
91ec907
Compare
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 missing some context on this topic, so I might miss things, and I'm taking what was already implemented as reference.
This looks good though! I left some questions for my own comprehension. My only concern is about the strategy for the isVersionSet
key that I could see skewed when counting SonarLint.
durationReport.stop(); | ||
} | ||
|
||
private void setTelemetry(SensorContext context, String[] pythonVersionParameter) { |
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.
The name of the method seems a bit misleading I guess, what we're doing here is update the Python version telemetry rather than "setting it", no? (I initially thought this was about setting a telemetry field to the context...)
What about updatePythonVersionTelemetry
?
|
||
public PythonSensor(FileLinesContextFactory fileLinesContextFactory, CheckFactory checkFactory, NoSonarFilter noSonarFilter, | ||
@Nullable PythonCustomRuleRepository[] customRuleRepositories, @Nullable PythonIndexer indexer, | ||
@Nullable SonarLintCache sonarLintCache, AnalysisWarningsWrapper analysisWarnings, SensorTelemetryStorage sensorTelemetryStorage) { |
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 I understand in which case we should expect this sensorTelemetryStorage
to be injected and in which case we should expect to instantiate it ourselves, and what difference it makes, can you explain?
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.
A similar point was raised by Maksim. The goal is to be able to inject the storage as a mock and test it that way.
I should probably rewrite it to use Mockito on the sendTelemetryProperty
mock on the SensorContextTester
durationReport.stop(); | ||
} | ||
|
||
private void setTelemetry(SensorContext context, String[] pythonVersionParameter) { | ||
var isVersionSet = pythonVersionParameter.length != 0 || context.runtime().getProduct() == SonarProduct.SONARLINT; |
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.
Why do we consider the version to be set in SonarLint context? Wouldn't that skew the data and imply more people actively set the version than what actually happens?
private void setTelemetry(SensorContext context, String[] pythonVersionParameter) { | ||
var isVersionSet = pythonVersionParameter.length != 0 || context.runtime().getProduct() == SonarProduct.SONARLINT; | ||
if (pythonVersionParameter.length != 0) { | ||
sensorTelemetryStorage.updateMetric(TelemetryMetricKey.PYTHON_VERSION_KEY, String.join(",", pythonVersionParameter)); |
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.
So that means we can set more than just booleans for the telemetry?
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.
Yes, CFamily is sending strings.
91ec907
to
4acefce
Compare
d7f764c
to
cba6ca6
Compare
4acefce
to
c7952d8
Compare
cba6ca6
to
47eab69
Compare
c7952d8
to
e57c2f0
Compare
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!
Out of curiosity, why don't we send telemetry from sonarlint? Would it just screw up the data too much?
I don't think telemetry is sent right now on their side anyways. |
47eab69
to
cddb775
Compare
63aa67f
to
0c34b58
Compare
0c34b58
to
6dee94c
Compare
Quality Gate passedIssues Measures |
SONARPY-2457