Skip to content

Commit

Permalink
[APM][ECO] Remove log.level filter from log rate metric collection (e…
Browse files Browse the repository at this point in the history
…lastic#192500)

## Summary

closes elastic#189923 

- EEM: remove `log.level` filter and filter based on `data_stream.type:
logs`
- log-data-access: remove `log.level` filter
- ECO: Update the formula and Explore log filter and remove the N/A
badge


https://github.com/user-attachments/assets/9b190ba7-c28b-44cf-bb0b-6dbdfe47ced4

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
kpatticha and kibanamachine authored Sep 13, 2024
1 parent d07ba0f commit 48bbdd8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ export function LogRateChart({ height }: { height: number }) {
</EuiFlexItem>

<EuiFlexItem grow={false}>
<ExploreLogsButton
start={start}
end={end}
kuery={`log.level: * AND service.name: "${serviceName}"`}
/>
<ExploreLogsButton start={start} end={end} kuery={`service.name: "${serviceName}"`} />
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ import { NotAvailableApmMetrics } from '../../../../shared/not_available_popover
import { TruncateWithTooltip } from '../../../../shared/truncate_with_tooltip';
import { ServiceInventoryFieldName } from './multi_signal_services_table';
import { EntityDataStreamType } from '../../../../../../common/entities/types';
import { isApmSignal, isLogsSignal } from '../../../../../utils/get_signal_type';
import { isApmSignal } from '../../../../../utils/get_signal_type';
import { ColumnHeader } from './column_header';
import { APIReturnType } from '../../../../../services/rest/create_call_apm_api';
import { NotAvailableLogsMetrics } from '../../../../shared/not_available_popover/not_available_log_metrics';

type ServicesDetailedStatisticsAPIResponse =
APIReturnType<'POST /internal/apm/entities/services/detailed_statistics'>;
Expand Down Expand Up @@ -204,10 +203,6 @@ export function getServiceColumns({
dataType: 'number',
align: RIGHT_ALIGNMENT,
render: (_, { metrics, serviceName, dataStreamTypes, hasLogMetrics }) => {
if (isLogsSignal(dataStreamTypes) && !hasLogMetrics) {
return <NotAvailableLogsMetrics />;
}

const { currentPeriodColor } = getTimeSeriesColor(ChartType.LOG_RATE);
return (
<ListMetric
Expand Down Expand Up @@ -256,10 +251,6 @@ export function getServiceColumns({
dataType: 'number',
align: RIGHT_ALIGNMENT,
render: (_, { metrics, serviceName, dataStreamTypes, hasLogMetrics }) => {
if (isLogsSignal(dataStreamTypes) && !hasLogMetrics) {
return <NotAvailableLogsMetrics />;
}

const { currentPeriodColor } = getTimeSeriesColor(ChartType.LOG_ERROR_RATE);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export enum ChartMetricType {
}

const metricsFormulasMap: Record<ChartMetricType, string> = {
[ChartMetricType.LOG_RATE]: `count(kql='log.level: *') / [PERIOD_IN_MINUTES]`,
[ChartMetricType.LOG_RATE]: `count() / [PERIOD_IN_MINUTES]`,
[ChartMetricType.LOG_ERROR_RATE]: `count(kql='log.level: "error" OR log.level: "ERROR" OR error.log.level: "error" OR error.log.level: "ERROR"') / [PERIOD_IN_MINUTES]`,
};

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const serviceTransactionFilter = (additionalFilters: string[] = []) => {

export const builtInServicesFromLogsEntityDefinition: EntityDefinition =
entityDefinitionSchema.parse({
version: '1.0.2',
version: '1.0.3',
id: `${BUILT_IN_ID_PREFIX}services_from_ecs_data`,
name: 'Services from ECS data',
description:
Expand Down Expand Up @@ -121,7 +121,7 @@ export const builtInServicesFromLogsEntityDefinition: EntityDefinition =
{
name: 'A',
aggregation: 'doc_count',
filter: 'log.level: * OR error.log.level: *',
filter: 'data_stream.type: logs',
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ElasticsearchClient } from '@kbn/core/server';
import { estypes } from '@elastic/elasticsearch';
import { getBucketSizeFromTimeRangeAndBucketCount } from '../../utils';
import { ERROR_LOG_LEVEL, LOG_LEVEL } from '../../es_fields';
import { existsQuery, kqlQuery } from '../../utils/es_queries';
import { kqlQuery } from '../../utils/es_queries';

export interface LogsErrorRateTimeseries {
esClient: ElasticsearchClient;
Expand Down Expand Up @@ -81,7 +81,6 @@ export function createGetLogErrorRateTimeseries() {
query: {
bool: {
filter: [
...existsQuery(LOG_LEVEL),
...kqlQuery(kuery),
{
terms: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import type { AggregationOptionsByType, AggregationResultOf } from '@kbn/es-type
import { ElasticsearchClient } from '@kbn/core/server';
import { estypes } from '@elastic/elasticsearch';
import { getBucketSizeFromTimeRangeAndBucketCount } from '../../utils';
import { LOG_LEVEL } from '../../es_fields';
import { existsQuery, kqlQuery } from '../../utils/es_queries';
import { kqlQuery } from '../../utils/es_queries';

export interface LogsRateTimeseries {
esClient: ElasticsearchClient;
Expand Down Expand Up @@ -59,7 +58,6 @@ export function createGetLogsRateTimeseries() {
query: {
bool: {
filter: [
...existsQuery(LOG_LEVEL),
...kqlQuery(kuery),
{
terms: {
Expand Down

0 comments on commit 48bbdd8

Please sign in to comment.