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

[Maps][Telemetry] Fix issue when index pattern has no fields #58242

Merged

Conversation

kindsun
Copy link
Contributor

@kindsun kindsun commented Feb 21, 2020

If an index pattern has no fields, it can potentially trigger the following error when telemetry attempts to parse an undefined value. This PR adds code to ensure fields exists prior to parsing. Backporting to 7.6.x since it was introduced in #51221

server    log   [10:15:02.969] [warning][plugins][usageCollection] SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at map (/Users/joekibana/dev/kibana-master-git/kibana/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts:86:61)
    at Array.map (<anonymous>)
    at getIndexPatternsWithGeoFieldCount (/Users/joekibana/dev/kibana-master-git/kibana/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts:86:36)
    at buildMapsTelemetry (/Users/joekibana/dev/kibana-master-git/kibana/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts:134:42)
    at getMapsTelemetry (/Users/joekibana/dev/kibana-master-git/kibana/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts:189:25)
    at process._tickCallback (internal/process/next_tick.js:68:7)
server    log   [10:15:02.970] [warning][plugins][usageCollection] Unable to fetch data from maps-telemetry collector

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

lgtm
code review

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kindsun kindsun merged commit cca7555 into elastic:master Feb 21, 2020
kindsun pushed a commit to kindsun/kibana that referenced this pull request Feb 21, 2020
kindsun pushed a commit to kindsun/kibana that referenced this pull request Feb 21, 2020
mbondyra added a commit to mbondyra/kibana that referenced this pull request Feb 21, 2020
…_improve-advanced-settings-save

* commit '02efb01c481f9f24d8d707f06dfc68b2fb805001': (43 commits)
  [Endpoint] Add a flyout to alert list. (elastic#57926)
  Make sure index pattern has fields before parsing (elastic#58242)
  Sanitize workpad before sending to API (elastic#57704)
  [ML] Transform: Support multi-line JSON notation in advanced editor (elastic#58015)
  [Endpoint] Refactor Management List Tests (elastic#58148)
  [kbn/optimizer] include bootstrap cache key in optimizer cache key (elastic#58176)
  Do not refresh color scale on each lookup (elastic#57792)
  Updating to @elastic/lodash@3.10.1-kibana4 (elastic#54662)
  Trigger context (elastic#57870)
  [ML] Transforms: Adds clone feature to transforms list. (elastic#57837)
  [ML] New Platform server shim: update fields service routes (elastic#58060)
  [Endpoint] EMT-184: change endpoints to metadata up and down the code base. (elastic#58038)
  document difference between log record formats (elastic#57798)
  Expose elasticsearch config schema (elastic#57655)
  [ui/agg_response/tabify] update types for search/expressions/build_tabular_inspector_data.ts (elastic#58130)
  [SIEM] Cleans Cypress tests code (elastic#58134)
  fix: 🐛 make dev server Storybook builds work again (elastic#58188)
  Prevent core savedObjects plugin from being overridden (elastic#58193)
  Expose serverBasePath on client-side (elastic#58070)
  Fix legend sizing on area charts (elastic#58083)
  ...
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 24, 2020
…-out-of-legacy

* 'master' of github.com:elastic/kibana:
  [SIEM] [Case] Enable case by default. Snake to camel on UI (elastic#57936)
  [File upload] Update remaining File Upload dependencies for NP migration (elastic#58128)
  Use EuiTokens for ES field types (elastic#57911)
  Added UI support for the default action group for Alert Type Model (elastic#57603)
  force savedObject API consumers to define SO type explicitly (elastic#58022)
  Update dependency @elastic/charts to ^17.1.1 (elastic#57634)
  [Endpoint] Add a flyout to alert list. (elastic#57926)
  Make sure index pattern has fields before parsing (elastic#58242)
  Sanitize workpad before sending to API (elastic#57704)
  [ML] Transform: Support multi-line JSON notation in advanced editor (elastic#58015)
  [Endpoint] Refactor Management List Tests (elastic#58148)
  [kbn/optimizer] include bootstrap cache key in optimizer cache key (elastic#58176)
  Do not refresh color scale on each lookup (elastic#57792)
  Updating to @elastic/lodash@3.10.1-kibana4 (elastic#54662)
  Trigger context (elastic#57870)
  [ML] Transforms: Adds clone feature to transforms list. (elastic#57837)
  [ML] New Platform server shim: update fields service routes (elastic#58060)
  [Endpoint] EMT-184: change endpoints to metadata up and down the code base. (elastic#58038)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants