Skip to content

Commit

Permalink
change to enable the new api on the kibana config
Browse files Browse the repository at this point in the history
  • Loading branch information
crespocarlos committed Mar 3, 2025
1 parent 5fa4ec0 commit 2f2be9a
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export const OBSERVABILITY_APM_ENABLE_CONTINUOUS_ROLLUPS_ID =
export const OBSERVABILITY_APM_ENABLE_PROFILING_INTEGRATION_ID =
'observability:apmEnableProfilingIntegration';
export const OBSERVABILITY_APM_ENABLE_TABLE_SEARCH_BAR = 'observability:apmEnableTableSearchBar';
export const OBSERVABILITY_APM_ENABLE_SERVICE_MAP_V2 = 'observability:apmEnableServiceMapV2';
export const OBSERVABILITY_APM_ENABLE_SERVICE_INVENTORY_TABLE_SEARCH_BAR =
'observability:apmEnableServiceInventoryTableSearchBar';
export const OBSERVABILITY_LOGS_SHARED_NEW_LOGS_OVERVIEW_ID = 'observability:newLogsOverview';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const OBSERVABILITY_PROJECT_SETTINGS = [
settings.OBSERVABILITY_APM_ENABLE_CRITICAL_PATH_ID,
settings.OBSERVABILITY_ENABLE_INFRASTRUCTURE_ASSET_CUSTOM_DASHBOARDS_ID,
settings.OBSERVABILITY_APM_ENABLE_TABLE_SEARCH_BAR,
settings.OBSERVABILITY_APM_ENABLE_SERVICE_MAP_V2,
settings.OBSERVABILITY_APM_ENABLE_SERVICE_INVENTORY_TABLE_SEARCH_BAR,
settings.OBSERVABILITY_ENTITY_CENTRIC_EXPERIENCE,
settings.OBSERVABILITY_AI_ASSISTANT_SIMULATED_FUNCTION_CALLING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,6 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:apmEnableServiceMapV2': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:entityCentricExperience': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export interface UsageStats {
'observability:enableInfrastructureAssetCustomDashboards': boolean;
'observability:apmAgentExplorerView': boolean;
'observability:apmEnableTableSearchBar': boolean;
'observability:apmEnableServiceMapV2': boolean;
'observability:apmEnableServiceInventoryTableSearchBar': boolean;
'observability:logSources': string[];
'observability:newLogsOverview': boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function addMessagingConnections(
connections: Connection[],
destinationServices: ExitSpanDestination[]
): Connection[] {
// Index discoveredServices by SPAN_DESTINATION_SERVICE_RESOURCE for quick lookups
const serviceMap = new Map(
destinationServices.map(({ from, to }) => [from[SPAN_DESTINATION_SERVICE_RESOURCE], to])
);
Expand All @@ -59,7 +58,6 @@ function addMessagingConnections(
function getAllNodes(services: ServicesResponse[], connections: Connection[]) {
const allNodesMap = new Map<string, ConnectionNode>();

// Process connections in one pass
connections.forEach((connection) => {
const sourceId = connection.source.id;
const destinationId = connection.destination.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
apmEnableTableSearchBar,
apmEnableTransactionProfiling,
apmEnableServiceInventoryTableSearchBar,
apmEnableServiceMapV2,
} from '@kbn/observability-plugin/common';
import { isEmpty } from 'lodash';
import React from 'react';
Expand Down Expand Up @@ -57,7 +56,6 @@ function getApmSettingsKeys(isProfilingIntegrationEnabled: boolean) {
enableAgentExplorerView,
apmEnableTableSearchBar,
apmEnableServiceInventoryTableSearchBar,
apmEnableServiceMapV2,
];

if (isProfilingIntegrationEnabled) {
Expand Down
1 change: 1 addition & 0 deletions x-pack/solutions/observability/plugins/apm/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const configSchema = schema.object({
serviceMapTraceIdGlobalBucketSize: schema.number({ defaultValue: 6 }),
serviceMapMaxTracesPerRequest: schema.number({ defaultValue: 50 }),
serviceMapTerminateAfter: schema.number({ defaultValue: 100_000 }),
serviceMapV2Enabled: schema.boolean({ defaultValue: false }),
serviceMapMaxTraces: schema.number({ defaultValue: 1000 }),
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export interface IEnvOptions {
end: number;
serviceGroupKuery?: string;
kuery?: string;
serviceMapV2Enabled?: boolean;
}

async function getConnectionData({
Expand All @@ -48,7 +47,6 @@ async function getConnectionData({
serviceGroupKuery,
kuery,
logger,
serviceMapV2Enabled = false,
}: IEnvOptions): Promise<
{ tracesCount: number } & (
| { connections: Connection[]; discoveredServices: ExitSpanDestination[] }
Expand All @@ -70,7 +68,7 @@ async function getConnectionData({

logger.debug(`Found ${traceIds.length} traces to inspect`);

if (serviceMapV2Enabled) {
if (config.serviceMapV2Enabled) {
const spans = await withApmSpan(
'get_service_map_exit_spans_and_transactions_from_traces',
() =>
Expand All @@ -88,8 +86,18 @@ async function getConnectionData({
};
}

if (!traceIds.length) {
return {
connections: [],
discoveredServices: [],
tracesCount: 0,
};
}

const chunkedResponses = await withApmSpan('get_service_paths_from_all_trace_ids', () => {
const chunks = chunk(traceIds, config.serviceMapMaxTracesPerRequest);
logger.debug(`Executing scripted metric agg (${chunks.length} chunks)`);

return Promise.all(
chunks.map((traceIdsChunk) =>
getServiceMapFromTraceIds({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

import Boom from '@hapi/boom';
import * as t from 'io-ts';
import {
apmEnableServiceMapV2,
apmServiceGroupMaxNumberOfServices,
} from '@kbn/observability-plugin/common';
import { apmServiceGroupMaxNumberOfServices } from '@kbn/observability-plugin/common';
import type { ServiceMapResponse } from '../../../common/service_map';
import { isActivePlatinumLicense } from '../../../common/license_check';
import { invalidLicenseMessage } from '../../../common/service_map/utils';
Expand Down Expand Up @@ -67,19 +64,17 @@ const serviceMapRoute = createApmServerRoute({
uiSettings: { client: uiSettingsClient },
} = await context.core;

const [mlClient, apmEventClient, serviceGroup, maxNumberOfServices, serviceMapV2Enabled] =
await Promise.all([
getMlClient(resources),
getApmEventClient(resources),
serviceGroupId
? getServiceGroup({
savedObjectsClient,
serviceGroupId,
})
: Promise.resolve(null),
uiSettingsClient.get<number>(apmServiceGroupMaxNumberOfServices),
uiSettingsClient.get<boolean>(apmEnableServiceMapV2),
]);
const [mlClient, apmEventClient, serviceGroup, maxNumberOfServices] = await Promise.all([
getMlClient(resources),
getApmEventClient(resources),
serviceGroupId
? getServiceGroup({
savedObjectsClient,
serviceGroupId,
})
: Promise.resolve(null),
uiSettingsClient.get<number>(apmServiceGroupMaxNumberOfServices),
]);

const searchAggregatedTransactions = await getSearchTransactionsEvents({
apmEventClient,
Expand All @@ -102,7 +97,6 @@ const serviceMapRoute = createApmServerRoute({
maxNumberOfServices,
serviceGroupKuery: serviceGroup?.kuery,
kuery,
serviceMapV2Enabled,
});
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export type MinimalApmPluginRequestHandlerContext = Omit<
export interface APMRouteCreateOptions {
tags?: Array<'oas-tag:APM agent keys' | 'oas-tag:APM annotations'>;
disableTelemetry?: boolean;
stream?: boolean;
}

export type TelemetryUsageCounter = ReturnType<UsageCollectionSetup['createUsageCounter']>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export {
enableInfrastructureAssetCustomDashboards,
enableAwsLambdaMetrics,
enableAgentExplorerView,
apmEnableServiceMapV2,
apmEnableTableSearchBar,
entityCentricExperience,
apmAWSLambdaPriceFactor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const enableInfrastructureAssetCustomDashboards =
export const enableAwsLambdaMetrics = 'observability:enableAwsLambdaMetrics';
export const enableAgentExplorerView = 'observability:apmAgentExplorerView';
export const apmEnableTableSearchBar = 'observability:apmEnableTableSearchBar';
export const apmEnableServiceMapV2 = 'observability:apmEnableServiceMapV2';
export const entityCentricExperience = 'observability:entityCentricExperience';
export const apmEnableServiceInventoryTableSearchBar =
'observability:apmEnableServiceInventoryTableSearchBar';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import {
apmEnableServiceInventoryTableSearchBar,
profilingFetchTopNFunctionsFromStacktraces,
searchExcludedDataTiers,
apmEnableServiceMapV2,
} from '../common/ui_settings_keys';

const betaLabel = i18n.translate('xpack.observability.uiSettings.betaLabel', {
Expand Down Expand Up @@ -366,23 +365,6 @@ export const uiSettings: Record<string, UiSettings> = {
type: 'boolean',
solution: 'oblt',
},
[apmEnableServiceMapV2]: {
category: [observabilityFeatureId],
name: i18n.translate('xpack.observability.apmEnableServiceMapV2', {
defaultMessage: 'Service Map API V2',
}),
description: i18n.translate('xpack.observability.apmEnableServiceMapV2Description', {
defaultMessage: '{technicalPreviewLabel} Enables the new service map API.',
values: {
technicalPreviewLabel: `<em>[${technicalPreviewLabel}]</em>`,
},
}),
schema: schema.boolean(),
value: false,
requiresPageReload: false,
type: 'boolean',
solution: 'oblt',
},
[apmAWSLambdaPriceFactor]: {
category: [observabilityFeatureId],
name: i18n.translate('xpack.observability.apmAWSLambdaPricePerGbSeconds', {
Expand Down

0 comments on commit 2f2be9a

Please sign in to comment.