Skip to content

Commit

Permalink
Merge branch 'master' into eui/37.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 9, 2021
2 parents 750a527 + a7c3172 commit 771cb11
Show file tree
Hide file tree
Showing 26 changed files with 301 additions and 288 deletions.
28 changes: 28 additions & 0 deletions dev_docs/troubleshooting.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
id: kibTroubleshooting
slug: /kibana-dev-docs/troubleshooting
title: Troubleshooting
summary: A collection of tips for working around strange issues.
date: 2021-09-08
tags: ['kibana', 'onboarding', 'dev', 'troubleshooting']
---

### Typescript issues

When switching branches, sometimes the TypeScript cache can get mixed up and show some invalid errors. If you run into TypeScript issues (invalid errors, or if it's taking too long to build types), here a few things to try.

1. Build TypeScript references with the clean command.

```
node scripts/build_ts_refs --clean
```

2. Restore your repository to a totally fresh state by running `git clean`

```
# dry-run the clean to see what will be deleted
git clean -fdxn -e /config -e /.vscode
# review the files which will be deleted, consider adding some more excludes (-e)
# re-run without the dry-run (-n) flag to actually delete the files
```
88 changes: 27 additions & 61 deletions docs/apm/correlations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,68 +58,34 @@ out, you can begin viewing sample traces to continue your investigation.
[[correlations-error-rate]]
==== Find failed transaction correlations

The correlations on the *Error rate* tab help you discover which fields are
contributing to failed transactions.

By default, a number of attributes commonly known to cause performance issues,
like version, infrastructure, and location, are included, but all are completely
customizable to your APM data. Find something interesting? A quick click of a
button will auto-query your data as you work to resolve the underlying issue.

The error rate over time chart visualizes the change in error rate over the selected time frame.
Correlated attributes are sorted by _Impact_–a visual representation of the
{ref}/search-aggregations-bucket-significantterms-aggregation.html[significant terms aggregation]
score that powers correlations.
Attributes with a high impact, or attributes present in a large percentage of failed transactions,
may contribute to increased error rates.

To find error rate correlations, hover over each potentially correlated attribute to
compare the error rate distribution of transactions with and without the selected attribute.

For example, in the screenshot below, the field `url.original` and value `http://localhost:3100...`
existed in 100% of failed transactions between 6:00 and 10:30.
beta::[]

The correlations on the *Failed transaction correlations* tab help you discover
which attributes are most influential in distinguishing between transaction
failures and successes. In this context, the success or failure of a transaction
is determined by its {ecs-ref}/ecs-event.html#field-event-outcome[event.outcome]
value. For example, APM agents set the `event.outcome` to `failure` when an HTTP
transaction returns a `5xx` status code.

// The chart highlights the failed transactions in the overall latency distribution for the transaction group.
If there are attributes that have a statistically significant correlation with
failed transactions, they are listed in a table. The table is sorted by scores,
which are mapped to high, medium, or low impact levels. Attributes with high
impact levels are more likely to contribute to failed transactions.
// By default, the attribute with the highest score is added to the chart. To see a different attribute in the chart, hover over its row in the table.

For example, in the screenshot below, the field
`kubernetes.pod.name` and value `frontend-node-59dff47885-fl5lb` has a medium
impact level and existed in 19% of the failed transactions.

[role="screenshot"]
image::apm/images/error-rate-hover.png[Correlations errors hover effect]

Select the `+` filter to create a new query in the {apm-app} for transactions with
`url.original: http://localhost:3100...`. With the "noise" now filtered out,
you can begin viewing sample traces to continue your investigation.

As you sift through erroneous transactions, you'll likely notice other interesting attributes.
Return to the correlations fly-out and select *Customize fields* to search on these new attributes.
You may need to do this a few times–each time filtering out more and more noise and bringing you
closer to a diagnosis.

[discrete]
[[correlations-customize-fields]]
===== Customize fields

By default, a handful of attributes commonly known to cause performance issues
are included in the analysis on the *Error rate* tab. You can add and remove
fields under the **Customize fields** dropdown.

The following fields are selected by default. To keep the default list
manageable, only the first six matching fields with wildcards are used.

**Frontend (RUM) agent:**

* `labels.*`
* `user.*`
* `user_agent.name`
* `user_agent.os.name`
* `url.original`

**Backend agents:**
image::apm/images/correlations-failed-transactions.png[Failed transaction correlations]

* `labels.*`
* `host.ip`
* `service.node.name`
* `service.version`
TIP: Some details, such as the failure and success percentages, are available
only when the
<<observability-enable-inspect-es-queries,observability:enableInspectEsQueries>>
advanced setting is enabled.

[TIP]
====
* Want to start over? Select **reset** to clear your customizations.
* The *Latency* tab does not have a **Customize fields** dropdown, since it
automatically considers all relevant fields in the transactions.
====
Select the `+` filter to create a new query in the {apm-app} for transactions
with this attribute. You might do his for multiple attributes--each time
filtering out more and more noise and bringing you closer to a diagnosis.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/apm/images/error-rate-hover.png
Binary file not shown.
15 changes: 0 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,9 @@
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.4.0",
"ajv": "^6.12.4",
"angular": "^1.8.0",
"angular-aria": "^1.8.0",
"angular-elastic": "^2.5.1",
"angular-recursion": "^1.0.5",
"angular-resource": "1.8.0",
"angular-route": "^1.8.0",
"angular-sanitize": "^1.8.0",
"angular-sortable-view": "^0.0.17",
Expand All @@ -201,7 +198,6 @@
"brace": "0.11.1",
"broadcast-channel": "^3.0.3",
"chalk": "^4.1.0",
"check-disk-space": "^2.1.0",
"cheerio": "^1.0.0-rc.9",
"chokidar": "^3.4.3",
"chroma-js": "^1.4.1",
Expand Down Expand Up @@ -237,15 +233,12 @@
"fflate": "^0.6.9",
"file-saver": "^1.3.8",
"file-type": "^10.9.0",
"focus-trap-react": "^3.1.1",
"font-awesome": "4.7.0",
"formsy-react": "^1.1.5",
"fp-ts": "^2.3.1",
"geojson-vt": "^3.2.1",
"get-port": "^5.0.0",
"getopts": "^2.2.5",
"getos": "^3.1.0",
"github-markdown-css": "^2.10.0",
"glob": "^7.1.2",
"glob-all": "^3.2.1",
"globby": "^11.0.3",
Expand Down Expand Up @@ -323,9 +316,7 @@
"pngjs": "^3.4.0",
"polished": "^3.7.2",
"prop-types": "^15.7.2",
"proper-lockfile": "^3.2.0",
"proxy-from-env": "1.0.0",
"proxyquire": "1.8.0",
"puid": "1.0.7",
"puppeteer": "^8.0.0",
"query-string": "^6.13.2",
Expand All @@ -341,7 +332,6 @@
"react-dropzone": "^4.2.9",
"react-fast-compare": "^2.0.4",
"react-grid-layout": "^0.16.2",
"react-input-range": "^1.3.0",
"react-intl": "^2.8.0",
"react-is": "^16.8.0",
"react-markdown": "^4.3.1",
Expand Down Expand Up @@ -406,9 +396,7 @@
"type-detect": "^4.0.8",
"typescript-fsa": "^3.0.0",
"typescript-fsa-reducers": "^1.2.2",
"ui-select": "0.19.8",
"unified": "^9.2.1",
"unstated": "^2.1.1",
"use-resize-observer": "^6.0.0",
"utility-types": "^3.10.0",
"uuid": "3.3.2",
Expand Down Expand Up @@ -601,7 +589,6 @@
"@types/prettier": "^2.1.5",
"@types/pretty-ms": "^5.0.0",
"@types/prop-types": "^15.7.3",
"@types/proper-lockfile": "^3.0.1",
"@types/rbush": "^3.0.0",
"@types/reach__router": "^1.2.6",
"@types/react": "^16.9.36",
Expand Down Expand Up @@ -696,7 +683,6 @@
"cypress-promise": "^1.1.0",
"cypress-real-events": "^1.4.0",
"debug": "^2.6.9",
"del-cli": "^3.0.1",
"delete-empty": "^2.0.0",
"dependency-check": "^4.1.0",
"diff": "^4.0.1",
Expand Down Expand Up @@ -830,7 +816,6 @@
"tape": "^5.0.1",
"tar-fs": "^2.1.0",
"tempy": "^0.3.0",
"terminal-link": "^2.1.1",
"terser": "^5.7.1",
"terser-webpack-plugin": "^2.1.2",
"tough-cookie": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export class DocLinksService {
kibanaSettings: `${KIBANA_DOCS}apm-settings-in-kibana.html`,
supportedServiceMaps: `${KIBANA_DOCS}service-maps.html#service-maps-supported`,
customLinks: `${KIBANA_DOCS}custom-links.html`,
droppedTransactionSpans: `${APM_DOCS}get-started/${DOC_LINK_VERSION}/transaction-spans.html#dropped-spans`,
upgrading: `${APM_DOCS}server/${DOC_LINK_VERSION}/upgrading.html`,
metaData: `${APM_DOCS}get-started/${DOC_LINK_VERSION}/metadata.html`,
droppedTransactionSpans: `${APM_DOCS}get-started/master/transaction-spans.html#dropped-spans`,
upgrading: `${APM_DOCS}server/master/upgrading.html`,
metaData: `${APM_DOCS}get-started/master/metadata.html`,
},
canvas: {
guide: `${KIBANA_DOCS}canvas.html`,
Expand Down
8 changes: 8 additions & 0 deletions x-pack/plugins/alerting/server/rules_client/rules_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,14 @@ export class RulesClient {
}

public async delete({ id }: { id: string }) {
return await retryIfConflicts(
this.logger,
`rulesClient.delete('${id}')`,
async () => await this.deleteWithOCC({ id })
);
}

private async deleteWithOCC({ id }: { id: string }) {
let taskIdToRemove: string | undefined | null;
let apiKeyToInvalidate: string | null = null;
let attributes: RawAlert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,16 @@ describe('RoleMappingsLogic', () => {

expect(flashAPIErrors).toHaveBeenCalledWith('this is an error');
});

it('resets roleMapping state', () => {
mount({
...mappingsServerProps,
roleMapping: asRoleMapping,
});
RoleMappingsLogic.actions.initializeRoleMappings();

expect(RoleMappingsLogic.values.roleMapping).toEqual(null);
});
});

describe('initializeRoleMapping', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
null,
{
setRoleMapping: (_, { roleMapping }) => roleMapping,
initializeRoleMappings: () => null,
resetState: () => null,
closeUsersAndRolesFlyout: () => null,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';

import { EuiBadge, EuiBasicTableColumn, EuiInMemoryTable, EuiTextColor } from '@elastic/eui';
import type { EuiSearchBarOnChangeArgs } from '@elastic/eui';
Expand Down Expand Up @@ -57,6 +57,8 @@ const noItemsPlaceholder = <EuiTextColor color="subdued">&mdash;</EuiTextColor>;
const invitationBadge = <EuiBadge color="hollow">{INVITATION_PENDING_LABEL}</EuiBadge>;
const deactivatedBadge = <EuiBadge color="hollow">{DEACTIVATED_LABEL}</EuiBadge>;

type Users = Array<Omit<SharedUser, 'elasticsearchUser | roleMapping'>>;

export const UsersTable: React.FC<Props> = ({
accessItemKey,
singleUserRoleMappings,
Expand All @@ -72,9 +74,13 @@ export const UsersTable: React.FC<Props> = ({
id: user.roleMapping.id,
accessItems: (user.roleMapping as SharedRoleMapping)[accessItemKey],
invitation: user.invitation,
})) as unknown) as Array<Omit<SharedUser, 'elasticsearchUser | roleMapping'>>;
})) as unknown) as Users;

const [items, setItems] = useState([] as Users);

const [items, setItems] = useState(users);
useEffect(() => {
setItems(users);
}, [singleUserRoleMappings]);

const columns: Array<EuiBasicTableColumn<SharedUser>> = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,16 @@ describe('RoleMappingsLogic', () => {

expect(flashAPIErrors).toHaveBeenCalledWith('this is an error');
});

it('resets roleMapping state', () => {
mount({
...mappingsServerProps,
roleMapping: wsRoleMapping,
});
RoleMappingsLogic.actions.initializeRoleMappings();

expect(RoleMappingsLogic.values.roleMapping).toEqual(null);
});
});

describe('initializeRoleMapping', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
null,
{
setRoleMapping: (_, { roleMapping }) => roleMapping,
initializeRoleMappings: () => null,
resetState: () => null,
closeUsersAndRolesFlyout: () => null,
},
Expand Down
Loading

0 comments on commit 771cb11

Please sign in to comment.