[Search] Adds telemetry warning rules and fixes a bunch of telemetry issues (#181350)

## Summary

Enables telemetry warning eslint rule.

Fixes a bunch of missing telemetry strings.


### Checklist

Delete any items that are not applicable to this PR.

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Efe Gürkan YALAMAN 2024-04-23 15:49:25 +02:00 committed by GitHub
parent 4c09bc938c
commit 0a4081e1d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 110 additions and 31 deletions

View file

@ -1524,6 +1524,7 @@ module.exports = {
],
'@kbn/i18n/strings_should_be_translated_with_i18n': 'warn',
'@kbn/i18n/strings_should_be_translated_with_formatted_message': 'warn',
'@kbn/telemetry/event_generating_elements_should_be_instrumented': 'warn',
},
},
/**

View file

@ -253,6 +253,8 @@ export const AttachIndexBox: React.FC<AttachIndexBoxProps> = ({ connector }) =>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiButton
data-test-subj="entSearchContent-connector-connectorDetail-saveConfigurationButton"
data-telemetry-id="entSearchContent-connector-connectorDetail-saveConfigurationButton"
onClick={() => onSave()}
disabled={!selectedIndex || selectedIndex.label === connector.index_name}
isLoading={isSaveLoading}
@ -286,6 +288,8 @@ export const AttachIndexBox: React.FC<AttachIndexBoxProps> = ({ connector }) =>
<EuiFlexGroup justifyContent="center">
<EuiFlexItem grow={false}>
<EuiButton
data-telemetry-id="entSearchContent-connector-connectorDetail-createAttachIndexButton"
data-test-subj="entSearchContent-connector-connectorDetail-createAttachIndexButton"
iconType="sparkles"
color="primary"
fill

View file

@ -134,6 +134,8 @@ export const ConnectorConfiguration: React.FC = () => {
values={{
exampleLink: (
<EuiLink
data-test-subj="entSearchContent-connector-configuration-exampleConfigFileLink"
data-telemetry-id="entSearchContent-connector-configuration-exampleConfigFileLink"
href="https://github.com/elastic/connectors-python/blob/main/config.yml.example"
target="_blank"
external
@ -166,6 +168,8 @@ export const ConnectorConfiguration: React.FC = () => {
values={{
link: (
<EuiLink
data-test-subj="entSearchContent-connector-configuration-deploymentModeLink"
data-telemetry-id="entSearchContent-connector-configuration-deploymentModeLink"
href={docLinks.connectorsClientDeploy}
target="_blank"
external
@ -230,6 +234,7 @@ export const ConnectorConfiguration: React.FC = () => {
<EuiSpacer size="s" />
<EuiButton
disabled={!index}
data-test-subj="entSearchContent-connector-configuration-recheckNow"
data-telemetry-id="entSearchContent-connector-configuration-recheckNow"
iconType="refresh"
onClick={() => fetchConnector({ connectorId: connector.id })}
@ -272,7 +277,12 @@ export const ConnectorConfiguration: React.FC = () => {
defaultMessage="{advancedSyncRulesDocs} can override some configuration fields."
values={{
advancedSyncRulesDocs: (
<EuiLink href={docLinks.syncRules} target="_blank">
<EuiLink
data-test-subj="entSearchContent-connector-configuration-advancedSyncRulesDocsLink"
data-telemetry-id="entSearchContent-connector-configuration-advancedSyncRulesDocsLink"
href={docLinks.syncRules}
target="_blank"
>
{i18n.translate(
'xpack.enterpriseSearch.content.connector_detail.configurationConnector.connectorPackage.advancedSyncRulesDocs',
{ defaultMessage: 'Advanced Sync Rules' }
@ -417,7 +427,12 @@ export const ConnectorConfiguration: React.FC = () => {
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<EuiLink href={docLinks.connectors} target="_blank">
<EuiLink
data-test-subj="entSearchContent-connector-configuration-connectorDocumentationLink"
data-telemetry-id="entSearchContent-connector-configuration-connectorDocumentationLink"
href={docLinks.connectors}
target="_blank"
>
{i18n.translate(
'xpack.enterpriseSearch.content.connector_detail.configurationConnector.support.viewDocumentation.label',
{
@ -438,6 +453,8 @@ export const ConnectorConfiguration: React.FC = () => {
</EuiFlexItem>
<EuiFlexItem>
<EuiLink
data-test-subj="entSearchContent-connector-configuration-readmeLink"
data-telemetry-id="entSearchContent-connector-configuration-readmeLink"
href="https://github.com/elastic/connectors-python/blob/main/README.md"
target="_blank"
>
@ -451,7 +468,12 @@ export const ConnectorConfiguration: React.FC = () => {
</EuiFlexItem>
{docsUrl && (
<EuiFlexItem>
<EuiLink href={docsUrl} target="_blank">
<EuiLink
data-test-subj="entSearchContent-connector-configuration-deployWithDockerLink"
data-telemetry-id="entSearchContent-connector-configuration-deployWithDockerLink"
href={docsUrl}
target="_blank"
>
{i18n.translate(
'xpack.enterpriseSearch.content.connector_detail.configurationConnector.support.dockerDeploy.label',
{
@ -463,6 +485,8 @@ export const ConnectorConfiguration: React.FC = () => {
)}
<EuiFlexItem>
<EuiLink
data-test-subj="entSearchContent-connector-configuration-deployWithoutDockerLink"
data-telemetry-id="entSearchContent-connector-configuration-deployWithoutDockerLink"
href="https://github.com/elastic/connectors-python/blob/main/docs/CONFIG.md#run-the-connector-service-for-a-custom-connector"
target="_blank"
>

View file

@ -168,7 +168,9 @@ export const ConnectorStats: React.FC<ConnectorStatsProps> = ({ connector, index
</EuiFlexItem>
<EuiFlexItem>
<StatCard
title="Index"
title={i18n.translate('xpack.enterpriseSearch.connectors.connectorStats.indexTitle', {
defaultMessage: 'Index',
})}
content={
connector.index_name ? (
indexData ? (

View file

@ -306,7 +306,12 @@ export const NativeConnectorConfiguration: React.FC = () => {
}
)}
<EuiSpacer size="s" />
<EuiLink href={docLinks.documentLevelSecurity} target="_blank">
<EuiLink
data-test-subj="entSearchContent-connectorDetail-documentLevelSecurityLink"
data-telemetry-id="entSearchContent-connectorDetail-documentLevelSecurityLink"
href={docLinks.documentLevelSecurity}
target="_blank"
>
{i18n.translate(
'xpack.enterpriseSearch.content.indices.configurationConnector.nativeConnector.securityReminder.securityLinkLabel',
{

View file

@ -148,7 +148,12 @@ export const ConnectorDetailOverview: React.FC = () => {
defaultMessage="Convert it to a {link}, to be self-managed on your own infrastructure. Native connectors are available only in your Elastic Cloud deployment."
values={{
link: (
<EuiLink href={docLinks.buildConnector} target="_blank">
<EuiLink
data-test-subj="entSearchContent-connectorDetailOverview-nativeCloudCallout-connectorClientLink"
data-telemetry-id="entSearchContent-connectorDetailOverview-nativeCloudCallout-connectorClientLink"
href={docLinks.buildConnector}
target="_blank"
>
{i18n.translate(
'xpack.enterpriseSearch.content.connectors.overview.nativeCloudCallout.connectorClient',
{ defaultMessage: 'connector client' }
@ -160,7 +165,12 @@ export const ConnectorDetailOverview: React.FC = () => {
</p>
</EuiText>
<EuiSpacer size="s" />
<EuiButton color="warning" fill onClick={() => showModal()}>
<EuiButton
data-test-subj="entSearchContent-connectorDetailOverview-nativeCloudCallout-convertToSelfManagedClientButton"
color="warning"
fill
onClick={() => showModal()}
>
{i18n.translate(
'xpack.enterpriseSearch.content.indices.connectors.overview.convertConnector.buttonLabel',
{ defaultMessage: 'Convert connector' }

View file

@ -108,6 +108,8 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem>
<EuiButton
data-test-subj="entSearchContent-connectors-newConnectorButton"
data-telemetry-id="entSearchContent-connectors-newConnectorButton"
key="newConnector"
color="primary"
iconType="plusInCircle"
@ -128,6 +130,8 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
closePopover={() => setShowMoreOptionsPopover(false)}
button={
<EuiButtonIcon
data-test-subj="entSearchContent-connectors-newConnector-moreOptionsButton"
data-telemetry-id="entSearchContent-connectors-newConnector-moreOptionsButton"
color="primary"
display="fill"
size="m"
@ -199,6 +203,8 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
]
: [
<EuiButton
data-test-subj="entSearchContent-crawlers-newCrawlerButton"
data-telemetry-id="entSearchContent-crawlers-newCrawlerButton"
disabled={Boolean(errorConnectingMessage)}
key="newCrawler"
color="primary"
@ -216,7 +222,8 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
? [
<EuiButton
color="primary"
data-test-subj="entSearchContent-searchIndices-defaultSettings"
data-test-subj="entSearchContent-connectors-defaultSettingsPopover"
data-telemetry-id="entSearchContent-connectors-defaultSettingsPopover"
onClick={() => setShowDefaultSettingsFlyout(true)}
>
{i18n.translate(

View file

@ -41,6 +41,8 @@ export const CrawlerEmptyState: React.FC = () => {
}
actions={
<EuiButton
data-test-subj="entSearchContent-crawlers-emptyState-createCrawlerButton"
data-telemetry-id="entSearchContent-crawlers-emptyState-createCrawlerButton"
color="primary"
disabled={Boolean(errorConnectingMessage)}
fill

View file

@ -134,21 +134,19 @@ export const DeleteConnectorModal: React.FC<DeleteConnectorModalProps> = ({ isCr
</p>
<p>
{isCrawler && (
<>
<EuiText>
<FormattedMessage
id="xpack.enterpriseSearch.deleteConnectorModal.crawler.warning"
defaultMessage="Deleting this crawler will also delete its related index with all of its data and its Crawler configuration. Any associated search applications will no longer be able to access any data stored in this index. This action cannot be undone. Please type {connectorName} to confirm."
values={{
connectorName: (
<strong>
<EuiTextColor color="danger">{connectorName}</EuiTextColor>
</strong>
),
}}
/>
</EuiText>
</>
<EuiText>
<FormattedMessage
id="xpack.enterpriseSearch.deleteConnectorModal.crawler.warning"
defaultMessage="Deleting this crawler will also delete its related index with all of its data and its Crawler configuration. Any associated search applications will no longer be able to access any data stored in this index. This action cannot be undone. Please type {connectorName} to confirm."
values={{
connectorName: (
<strong>
<EuiTextColor color="danger">{connectorName}</EuiTextColor>
</strong>
),
}}
/>
</EuiText>
)}
{!isCrawler && (
<EuiText>
@ -199,13 +197,13 @@ export const DeleteConnectorModal: React.FC<DeleteConnectorModalProps> = ({ isCr
}
>
<EuiFieldText
data-test-subj="entSearchContent-connectors-deleteModal-input"
data-telemetry-id="entSearchContent-connectors-deleteModal-input"
onChange={(e) => setInputConnectorName(e.target.value)}
value={inputConnectorName}
/>
</EuiFormRow>
</EuiForm>
</EuiConfirmModal>
) : (
<></>
);
) : null;
};

View file

@ -119,6 +119,8 @@ export const ConnectorCheckable: React.FC<ConnectorCheckableProps> = ({
<PlatinumLicensePopover
button={
<EuiButtonIcon
data-test-subj="entSearchContent-connectors-selectConnector-licensePopoverButton"
data-telemetry-id="entSearchContent-connectors-selectConnector-licensePopoverButton"
aria-label={i18n.translate(
'xpack.enterpriseSearch.content.newIndex.selectConnector.openPopoverLabel',
{
@ -143,6 +145,8 @@ export const ConnectorCheckable: React.FC<ConnectorCheckableProps> = ({
<NativePopover
button={
<EuiButtonIcon
data-test-subj="entSearchContent-connectors-selectConnector-nativeInfoPopoverButton"
data-telemetry-id="entSearchContent-connectors-selectConnector-nativeInfoPopoverButton"
aria-label={i18n.translate(
'xpack.enterpriseSearch.content.newIndex.selectConnector.openNativePopoverLabel',
{
@ -169,6 +173,8 @@ export const ConnectorCheckable: React.FC<ConnectorCheckableProps> = ({
<EuiPopover
button={
<EuiButtonIcon
data-test-subj="entSearchContent-connectors-selectConnector-nativePopoverButton"
data-telemetry-id="entSearchContent-connectors-selectConnector-nativePopoverButton"
display="base"
color="primary"
iconType="boxesHorizontal"
@ -200,8 +206,7 @@ export const ConnectorCheckable: React.FC<ConnectorCheckableProps> = ({
{ defaultMessage: 'Setup a Native Connector' }
)}
</EuiContextMenuItem>,
<EuiSpacer size="s" />,
<EuiSpacer key="spacer" size="s" />,
<EuiContextMenuItem
key="client"
onClick={(e) => {
@ -263,7 +268,12 @@ export const ConnectorCheckable: React.FC<ConnectorCheckableProps> = ({
{documentationUrl && (
<EuiFlexItem grow={false}>
<EuiText size="xs">
<EuiLink target="_blank" href={documentationUrl}>
<EuiLink
data-test-subj="entSearchContent-connectors-selectConnector-documentationLink"
data-telemetry-id="entSearchContent-connectors-selectConnector-documentationLink"
target="_blank"
href={documentationUrl}
>
{i18n.translate(
'xpack.enterpriseSearch.content.indices.selectConnector.connectorCheckable.documentationLinkLabel',
{

View file

@ -73,6 +73,8 @@ export const NativePopover: React.FC<NativePopoverProps> = ({
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem grow={false}>
<EuiButton
data-test-subj="entSearchContent-connectors-nativePopover-trialButton"
data-telemetry-id="entSearchContent-connectors-nativePopover-trialButton"
iconType="popout"
target="_blank"
href="https://www.elastic.co/cloud/cloud-trial-overview"

View file

@ -295,6 +295,8 @@ export const SelectConnector: React.FC = () => {
</EuiFlexItem>
<EuiFlexItem>
<EuiFieldSearch
data-test-subj="entSearchContent-connectors-selectConnector-searchInput"
data-telemetry-id="entSearchContent-connectors-selectConnector-searchInput"
aria-label={i18n.translate(
'xpack.enterpriseSearch.content.indices.selectConnector.search.ariaLabel',
{ defaultMessage: 'Search through connectors' }
@ -365,6 +367,8 @@ export const SelectConnector: React.FC = () => {
/>
</p>
<EuiButton
data-test-subj="entSearchContent-connectors-selectConnector-cloudCallout-trialButton"
data-telemetry-id="entSearchContent-connectors-selectConnector-cloudCallout-trialButton"
color="primary"
fill
href="https://www.elastic.co/cloud/cloud-trial-overview"

View file

@ -76,7 +76,12 @@ export const DefaultSettingsFlyout: React.FC<DefaultSettingsFlyoutProps> = ({ cl
defaultMessage="These settings apply to all new Elasticsearch indices created by Search ingestion mechanisms. For API ingest-based indices, remember to include the pipeline when you ingest documents. These features are powered by {link}"
values={{
link: (
<EuiLink href={docLinks.ingestPipelines} target="_blank">
<EuiLink
data-test-subj="entSearchContent-defaultSettingsFlyout-ingestPipelinesLink"
data-telemetry-id="entSearchContent-defaultSettingsFlyout-ingestPipelinesLink"
href={docLinks.ingestPipelines}
target="_blank"
>
{i18n.translate(
'xpack.enterpriseSearch.defaultSettingsFlyout.body.description.ingestPipelinesLink.link',
{
@ -154,7 +159,12 @@ export const DefaultSettingsFlyout: React.FC<DefaultSettingsFlyoutProps> = ({ cl
defaultMessage: 'ML Inference',
})}
link={
<EuiLink href={docLinks.mlDocumentEnrichment} target="_blank">
<EuiLink
data-test-subj="entSearchContent-defaultSettingsFlyout-mlInferenceLink"
data-telemetry-id="entSearchContent-defaultSettingsFlyout-mlInferenceLink"
href={docLinks.mlDocumentEnrichment}
target="_blank"
>
{i18n.translate('xpack.enterpriseSearch.content.settings.mlInference.link', {
defaultMessage: 'Learn more about document enrichment with ML',
})}