-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Add transaction name filter in failed transaction rate rule type (
#155405) part of #152329 related work #154241 Introduces the Transaction name filter in the failed transaction rate rule type https://user-images.githubusercontent.com/3369346/233386404-1875b283-0321-4bf1-a7d3-66327f7d4ec5.mov ## Fixes The regression introduces in a previous [PR](fce4ef8) Existing rule types can have empty string in their params so we need to make sure we don't filter empty values as it will yield no results. --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
54457b0
commit 111d04f
Showing
8 changed files
with
214 additions
and
12 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
105 changes: 105 additions & 0 deletions
105
.../public/components/alerting/rule_types/transaction_error_rate_rule_type/index.stories.tsx
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,105 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { Story } from '@storybook/react'; | ||
import React, { ComponentType, useState } from 'react'; | ||
import { CoreStart } from '@kbn/core/public'; | ||
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public'; | ||
import { RuleParams, TransactionErrorRateRuleType } from '.'; | ||
import { AlertMetadata } from '../../utils/helper'; | ||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values'; | ||
|
||
const KibanaReactContext = createKibanaReactContext({ | ||
notifications: { toasts: { add: () => {} } }, | ||
} as unknown as Partial<CoreStart>); | ||
|
||
interface Args { | ||
ruleParams: RuleParams; | ||
metadata?: AlertMetadata; | ||
} | ||
|
||
export default { | ||
title: 'alerting/TransactionErrorRateRuleType', | ||
component: TransactionErrorRateRuleType, | ||
decorators: [ | ||
(StoryComponent: ComponentType) => { | ||
return ( | ||
<KibanaReactContext.Provider> | ||
<div style={{ width: 400 }}> | ||
<StoryComponent /> | ||
</div> | ||
</KibanaReactContext.Provider> | ||
); | ||
}, | ||
], | ||
}; | ||
|
||
export const CreatingInApmServiceOverview: Story<Args> = ({ | ||
ruleParams, | ||
metadata, | ||
}) => { | ||
const [params, setParams] = useState<RuleParams>(ruleParams); | ||
|
||
function setRuleParams(property: string, value: any) { | ||
setParams({ ...params, [property]: value }); | ||
} | ||
|
||
return ( | ||
<TransactionErrorRateRuleType | ||
ruleParams={params} | ||
metadata={metadata} | ||
setRuleParams={setRuleParams} | ||
setRuleProperty={() => {}} | ||
/> | ||
); | ||
}; | ||
|
||
CreatingInApmServiceOverview.args = { | ||
ruleParams: { | ||
environment: 'testEnvironment', | ||
serviceName: 'testServiceName', | ||
threshold: 1500, | ||
transactionType: 'testTransactionType', | ||
transactionName: 'GET /api/customer/:id', | ||
windowSize: 5, | ||
windowUnit: 'm', | ||
}, | ||
metadata: { | ||
environment: ENVIRONMENT_ALL.value, | ||
serviceName: undefined, | ||
}, | ||
}; | ||
|
||
export const CreatingInStackManagement: Story<Args> = ({ | ||
ruleParams, | ||
metadata, | ||
}) => { | ||
const [params, setParams] = useState<RuleParams>(ruleParams); | ||
|
||
function setRuleParams(property: string, value: any) { | ||
setParams({ ...params, [property]: value }); | ||
} | ||
|
||
return ( | ||
<TransactionErrorRateRuleType | ||
ruleParams={params} | ||
metadata={metadata} | ||
setRuleParams={setRuleParams} | ||
setRuleProperty={() => {}} | ||
/> | ||
); | ||
}; | ||
|
||
CreatingInStackManagement.args = { | ||
ruleParams: { | ||
environment: 'testEnvironment', | ||
threshold: 1500, | ||
windowSize: 5, | ||
windowUnit: 'm', | ||
}, | ||
metadata: undefined, | ||
}; |
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