-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into expression_error
- Loading branch information
Showing
101 changed files
with
1,027 additions
and
2,124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
id: kibDevTutorialDebugging | ||
slug: /kibana-dev-docs/tutorial/debugging | ||
title: Debugging in development | ||
summary: Learn how to debug Kibana while running from source | ||
date: 2021-04-26 | ||
tags: ['kibana', 'onboarding', 'dev', 'tutorials', 'debugging'] | ||
--- | ||
|
||
There are multiple ways to go about debugging Kibana when running from source. | ||
|
||
## Debugging using Chrome DevTools | ||
|
||
You will need to run Node using `--inspect` or `--inspect-brk` in order to enable the inspector. Additional information can be found in the [Node.js docs](https://nodejs.org/en/docs/guides/debugging-getting-started/). | ||
|
||
Once Node is running with the inspector enabled, you can open `chrome://inspect` in your Chrome browser. You should see a remote target for the inspector running. Click "inspect". You can now begin using the debugger. | ||
|
||
Next we will go over how to exactly enable the inspector for different aspects of the codebase. | ||
|
||
### Jest Unit Tests | ||
|
||
You will need to run Jest directly from the Node script: | ||
|
||
`node --inspect-brk scripts/jest [TestPathPattern]` | ||
|
||
### Functional Test Runner | ||
|
||
`node --inspect-brk scripts/functional_test_runner` | ||
|
||
### Development Server | ||
|
||
`node --inspect-brk scripts/kibana` | ||
|
||
## Debugging using logging | ||
|
||
When running Kibana, it's sometimes helpful to enable verbose logging. | ||
|
||
`yarn start --verbose` | ||
|
||
Using verbose logging usually results in much more information than you're interested in. The [logging documentation](https://www.elastic.co/guide/en/kibana/current/logging-settings.html) covers ways to change the log level of certain types. | ||
|
||
In the following example of a configuration stored in `config/kibana.dev.yml` we are logging all Elasticsearch queries and any logs created by the Management plugin. | ||
|
||
``` | ||
logging: | ||
appenders: | ||
console: | ||
type: console | ||
layout: | ||
type: pattern | ||
highlight: true | ||
root: | ||
appenders: [default, console] | ||
level: info | ||
loggers: | ||
- name: plugins.management | ||
level: debug | ||
- name: elasticsearch.query | ||
level: debug | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/kbn-test/src/kbn_client/kbn_client_requester.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { pathWithSpace } from './kbn_client_requester'; | ||
|
||
describe('pathWithSpace()', () => { | ||
it('adds a space to the path', () => { | ||
expect(pathWithSpace('hello')`/foo/bar`).toMatchInlineSnapshot(`"/s/hello/foo/bar"`); | ||
}); | ||
|
||
it('ignores the space when it is empty', () => { | ||
expect(pathWithSpace(undefined)`/foo/bar`).toMatchInlineSnapshot(`"/foo/bar"`); | ||
expect(pathWithSpace('')`/foo/bar`).toMatchInlineSnapshot(`"/foo/bar"`); | ||
}); | ||
|
||
it('ignores the space when it is the default space', () => { | ||
expect(pathWithSpace('default')`/foo/bar`).toMatchInlineSnapshot(`"/foo/bar"`); | ||
}); | ||
|
||
it('uriencodes variables in the path', () => { | ||
expect(pathWithSpace('space')`hello/${'funky/username🏴☠️'}`).toMatchInlineSnapshot( | ||
`"/s/space/hello/funky%2Fusername%F0%9F%8F%B4%E2%80%8D%E2%98%A0%EF%B8%8F"` | ||
); | ||
}); | ||
|
||
it('ensures the path always starts with a slash', () => { | ||
expect(pathWithSpace('foo')`hello/world`).toMatchInlineSnapshot(`"/s/foo/hello/world"`); | ||
expect(pathWithSpace()`hello/world`).toMatchInlineSnapshot(`"/hello/world"`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.