-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Reporting/Telemetry] Do not send telemetry if we are in screenshot mode #100388
[Reporting/Telemetry] Do not send telemetry if we are in screenshot mode #100388
Conversation
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.
code changes LGTM! a very welcomed changed :elasticheart:
Can we add a functional test do make sure this is working in the browser as intended?
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.
Thank you for these changes! This will prove super useful!
I've added a couple of comments & NITs.
@@ -17,6 +17,8 @@ import type { | |||
ApplicationStart, | |||
} from 'src/core/public'; | |||
|
|||
import { ScreenshotModePluginSetup } from 'src/plugins/screenshot_mode/public'; |
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.
NIT:
import { ScreenshotModePluginSetup } from 'src/plugins/screenshot_mode/public'; | |
import type { ScreenshotModePluginSetup } from 'src/plugins/screenshot_mode/public'; |
@@ -256,4 +256,15 @@ describe('TelemetryService', () => { | |||
expect(mockFetch).toHaveBeenCalledTimes(1); | |||
}); | |||
}); | |||
|
|||
describe('shouldSendTelemetry', () => { | |||
it('does not send telemetry if screenshotMode is true', () => { |
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.
Can we test the other scenario as well?
@@ -126,6 +131,10 @@ export class TelemetryService { | |||
return this.isOptedIn; | |||
}; | |||
|
|||
public canSendTelemetry = (): boolean => { |
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.
Would you mind adding the JSDocs to this public method?
@@ -126,6 +131,10 @@ export class TelemetryService { | |||
return this.isOptedIn; | |||
}; | |||
|
|||
public canSendTelemetry = (): boolean => { | |||
return Boolean(this.getIsOptedIn() && !this.isScreenshotMode); |
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.
NITs:
- Why do we need to wrap it as Boolean?
- Can we check
isScreenshotMode
first to avoid running the additional checks ofgetIsOptedIn()
?
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 need to wrap it as Boolean?
I wanted to be explicit about the return type and getIsOptedIn
returns a boolean | null
. Happy to update that function return value with a Boolean()
instead?
Can we check isScreenshotMode first to avoid running the additional checks of getIsOptedIn()?
Can do!
* added another Jest test * move Boolean() to make the opt-in value always boolean
- added plugin functional test - added jest test to check TelemetrySender behaviour - exported the localStorage/window value that flags screenshot mode
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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
Pinging @elastic/kibana-app-services (Team:AppServices) |
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
@elasticmachine merge upstream |
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. @afharo's comments are addressed. He's on PTO so we can dismiss his review
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Public APIs missing comments
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
…ode (elastic#100388) * do not send telemetry if isScreenshotMode * Implement PR feedback: * added another Jest test * move Boolean() to make the opt-in value always boolean * remove unused import and convert to import type * fix type issues * update jest snapshot * Expanded test coverage - added plugin functional test - added jest test to check TelemetrySender behaviour - exported the localStorage/window value that flags screenshot mode * fix test plugin name in package.json and make sure to opt out of telemetry when the test finishes * added missing type file to plugin_functional test Co-authored-by: Kibana Machine <[email protected]> # Conflicts: # src/plugins/telemetry/kibana.json
…ode (#100388) (#101076) * do not send telemetry if isScreenshotMode * Implement PR feedback: * added another Jest test * move Boolean() to make the opt-in value always boolean * remove unused import and convert to import type * fix type issues * update jest snapshot * Expanded test coverage - added plugin functional test - added jest test to check TelemetrySender behaviour - exported the localStorage/window value that flags screenshot mode * fix test plugin name in package.json and make sure to opt out of telemetry when the test finishes * added missing type file to plugin_functional test Co-authored-by: Kibana Machine <[email protected]> # Conflicts: # src/plugins/telemetry/kibana.json
…sens/kibana into reporting/new-png-pdf-report-type * 'reporting/new-png-pdf-report-type' of github.com:jloleysens/kibana: (46 commits) [Security Solution] Add Ransomware canary advanced policy option (elastic#101068) [Exploratory view] Core web vitals (elastic#100320) [Security solution][Endpoint] Add unit tests for fleet event filters/trusted apps cards (elastic#101034) [Lens] Use a setter function for the dimension panel (elastic#101123) [Index Patterns] Fix return saved index pattern object (elastic#101051) [CI] For PRs, build TS refs before public api docs check (elastic#100791) [Maps] fix line and polygon label regression (elastic#101085) Migrate CCR to new ES JS client. (elastic#100131) [Canvas] Switch Canvas to use React Router (elastic#100579) [Expressions] Use table column ID instead of name when set (elastic#99724) [DOCS] Updates docs landing page (elastic#100749) [DOCS] Corrects typo in step 3 (elastic#101079) [DOCS] Updates runtime example in Discover (elastic#100926) Migrate kibana.autocomplete config to data plugin (elastic#100586) [Uptime] New width/delay definition for waterfall sidebar item tooltip (elastic#100147) [FTR] Use importExport for saved_object/basic archive (elastic#100244) [Fleet] Better input for multi text input in agent policy builder (elastic#101020) [CI] Buildkite support with Baseline pipeline (elastic#100492) [Reporting/Telemetry] Do not send telemetry if we are in screenshot mode (elastic#100388) Create API keys with metadata (elastic#100682) ...
Summary
Fix #41402
To reviewers
Checklist
Delete any items that are not applicable to this PR.