Skip to content

Commit

Permalink
[Logs UX] Classify logs-data-access and logs-shared as platform plugi…
Browse files Browse the repository at this point in the history
…ns (#201263)

This classifies `@kbn/logs-data-access-plugin`,
`@kbn/logs-shared-plugin` and `@kbn/observability-logs-overview` as
"platform/shared".

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit d5e0d3a)

# Conflicts:
#	.eslintrc.js
  • Loading branch information
weltenwort committed Dec 17, 2024
1 parent 4e7bca8 commit a9c510f
Show file tree
Hide file tree
Showing 21 changed files with 233 additions and 133 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1998,9 +1998,6 @@ module.exports = {
},
{
files: [
// logsShared depends on o11y/private plugins, but platform plugins depend on it
'x-pack/plugins/observability_solution/logs_shared/**',

// this plugin depends on visTypeTimeseries plugin (for TSVB viz) which is platform/private ATM
'x-pack/plugins/observability_solution/infra/**',

Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-xstate-utils/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"owner": [
"@elastic/obs-ux-logs-team"
],
"group": "observability",
"visibility": "private"
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { SerializableRecord } from '@kbn/utility-types';

export const TRANSACTION_DETAILS_BY_TRACE_ID_LOCATOR = 'TRANSACTION_DETAILS_BY_TRACE_ID_LOCATOR';

export interface TransactionDetailsByTraceIdLocatorParams extends SerializableRecord {
rangeFrom?: string;
rangeTo?: string;
traceId: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './apm';
export * from './dataset_quality';
export * from './dataset_quality_details';
export * from './logs_explorer';
Expand Down
4 changes: 2 additions & 2 deletions x-pack/packages/observability/logs_overview/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"owner": [
"@elastic/obs-ux-logs-team"
],
"group": "observability",
"visibility": "private"
"group": "platform",
"visibility": "shared"
}
5 changes: 0 additions & 5 deletions x-pack/plugins/observability_solution/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { enableInfrastructureHostsView } from '@kbn/observability-plugin/public'
import {
METRICS_EXPLORER_LOCATOR_ID,
MetricsExplorerLocatorParams,
ObservabilityTriggerId,
} from '@kbn/observability-shared-plugin/common';
import {
BehaviorSubject,
Expand Down Expand Up @@ -103,10 +102,6 @@ export class Plugin implements InfraClientPluginClass {
registerFeatures(pluginsSetup.home);
}

pluginsSetup.uiActions.registerTrigger({
id: ObservabilityTriggerId.LogEntryContextMenu,
});

const assetDetailsLocator =
pluginsSetup.share.url.locators.get<AssetDetailsLocatorParams>(ASSET_DETAILS_LOCATOR_ID);
const inventoryLocator =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"type": "plugin",
"id": "@kbn/logs-data-access-plugin",
"owner": ["@elastic/obs-ux-logs-team"],
"owner": [
"@elastic/obs-ux-logs-team"
],
"group": "platform",
"visibility": "shared",
"plugin": {
"id": "logsDataAccess",
"server": true,
"browser": true,
"requiredPlugins": [
"data",
"data",
"dataViews"
],
"optionalPlugins": [],
Expand Down
18 changes: 14 additions & 4 deletions x-pack/plugins/observability_solution/logs_shared/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,39 @@
"type": "plugin",
"id": "@kbn/logs-shared-plugin",
"owner": "@elastic/obs-ux-logs-team",
"group": "platform",
"visibility": "shared",
"description": "Exposes the shared components and APIs to access and visualize logs.",
"plugin": {
"id": "logsShared",
"server": true,
"browser": true,
"configPath": ["xpack", "logs_shared"],
"configPath": [
"xpack",
"logs_shared"
],
"requiredPlugins": [
"charts",
"data",
"fieldFormats",
"dataViews",
"discoverShared",
"logsDataAccess",
"observabilityShared",
"share",
"spaces",
"uiActions",
"usageCollection",
"embeddable",
],
"optionalPlugins": [
"observabilityAIAssistant",
],
"requiredBundles": ["kibanaUtils", "kibanaReact"],
"extraPublicDirs": ["common"]
"requiredBundles": [
"kibanaUtils",
"kibanaReact"
],
"extraPublicDirs": [
"common"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { buildEsQuery, Filter, Query } from '@kbn/es-query';
import { euiStyled } from '@kbn/kibana-react-plugin/common';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import type { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import { JsonValue } from '@kbn/utility-types';
import { noop } from 'lodash';
import React, { useCallback, useEffect, useMemo } from 'react';
import usePrevious from 'react-use/lib/usePrevious';
import type { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
import { useKibanaQuerySettings } from '@kbn/observability-shared-plugin/public';
import { LogEntryCursor } from '../../../common/log_entry';
import { defaultLogViewsStaticConfig, LogViewReference } from '../../../common/log_views';
import { BuiltEsQuery, useLogStream } from '../../containers/logs/log_stream';
import { useLogView } from '../../hooks/use_log_view';
import { LogViewsClient } from '../../services/log_views';
import { LogColumnRenderConfiguration } from '../../utils/log_column_render_configuration';
import { useKibanaQuerySettings } from '../../utils/use_kibana_query_settings';
import { useLogEntryFlyout } from '../logging/log_entry_flyout';
import { ScrollableLogTextStreamView, VisibleInterval } from '../logging/log_text_stream';
import { LogStreamErrorBoundary } from './log_stream_error_boundary';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import { coreMock } from '@kbn/core/public/mocks';
import {
TRANSACTION_DETAILS_BY_TRACE_ID_LOCATOR,
TransactionDetailsByTraceIdLocatorParams,
uptimeOverviewLocatorID,
UptimeOverviewLocatorInfraParams,
UptimeOverviewLocatorParams,
Expand All @@ -26,17 +28,23 @@ coreStartMock.application.getUrlForApp.mockImplementation((app, options) => {
});

const emptyUrlService = new MockUrlService();
const urlServiceWithUptimeLocator = new MockUrlService();
const urlServiceWithMockLocators = new MockUrlService();
// we can't use the actual locator here because its import would create a
// forbidden ts project reference cycle
urlServiceWithUptimeLocator.locators.create<
urlServiceWithMockLocators.locators.create<
UptimeOverviewLocatorInfraParams | UptimeOverviewLocatorParams
>({
id: uptimeOverviewLocatorID,
getLocation: async (params) => {
return { app: 'uptime', path: '/overview', state: {} };
},
});
urlServiceWithMockLocators.locators.create<TransactionDetailsByTraceIdLocatorParams>({
id: TRANSACTION_DETAILS_BY_TRACE_ID_LOCATOR,
getLocation: async (params) => {
return { app: 'apm', path: '/trace-id', state: {} };
},
});

const ProviderWrapper: FC<React.PropsWithChildren<{ urlService?: UrlService }>> = ({
children,
Expand Down Expand Up @@ -90,7 +98,7 @@ describe('LogEntryActionsMenu component', () => {
describe('uptime link with legacy uptime enabled', () => {
it('renders as enabled when a host ip is present in the log entry', () => {
const elementWrapper = mount(
<ProviderWrapper urlService={urlServiceWithUptimeLocator}>
<ProviderWrapper urlService={urlServiceWithMockLocators}>
<LogEntryActionsMenu
logEntry={{
fields: [{ field: 'host.ip', value: ['HOST_IP'] }],
Expand Down Expand Up @@ -120,7 +128,7 @@ describe('LogEntryActionsMenu component', () => {

it('renders as enabled when a container id is present in the log entry', () => {
const elementWrapper = mount(
<ProviderWrapper urlService={urlServiceWithUptimeLocator}>
<ProviderWrapper urlService={urlServiceWithMockLocators}>
<LogEntryActionsMenu
logEntry={{
fields: [{ field: 'container.id', value: ['CONTAINER_ID'] }],
Expand Down Expand Up @@ -150,7 +158,7 @@ describe('LogEntryActionsMenu component', () => {

it('renders as enabled when a pod uid is present in the log entry', () => {
const elementWrapper = mount(
<ProviderWrapper urlService={urlServiceWithUptimeLocator}>
<ProviderWrapper urlService={urlServiceWithMockLocators}>
<LogEntryActionsMenu
logEntry={{
fields: [{ field: 'kubernetes.pod.uid', value: ['POD_UID'] }],
Expand Down Expand Up @@ -180,7 +188,7 @@ describe('LogEntryActionsMenu component', () => {

it('renders as disabled when no supported field is present in the log entry', () => {
const elementWrapper = mount(
<ProviderWrapper urlService={urlServiceWithUptimeLocator}>
<ProviderWrapper urlService={urlServiceWithMockLocators}>
<LogEntryActionsMenu
logEntry={{
fields: [],
Expand Down Expand Up @@ -215,7 +223,7 @@ describe('LogEntryActionsMenu component', () => {
describe('apm link', () => {
it('renders with a trace id filter when present in log entry', () => {
const elementWrapper = mount(
<ProviderWrapper>
<ProviderWrapper urlService={urlServiceWithMockLocators}>
<LogEntryActionsMenu
logEntry={{
fields: [{ field: 'trace.id', value: ['1234567'] }],
Expand Down Expand Up @@ -246,7 +254,7 @@ describe('LogEntryActionsMenu component', () => {
it('renders with a trace id filter and timestamp when present in log entry', () => {
const timestamp = '2019-06-27T17:44:08.693Z';
const elementWrapper = mount(
<ProviderWrapper>
<ProviderWrapper urlService={urlServiceWithMockLocators}>
<LogEntryActionsMenu
logEntry={{
fields: [
Expand Down Expand Up @@ -279,7 +287,7 @@ describe('LogEntryActionsMenu component', () => {

it('renders as disabled when no supported field is present in log entry', () => {
const elementWrapper = mount(
<ProviderWrapper>
<ProviderWrapper urlService={urlServiceWithMockLocators}>
<LogEntryActionsMenu
logEntry={{
fields: [],
Expand All @@ -303,7 +311,10 @@ describe('LogEntryActionsMenu component', () => {
elementWrapper.update();

expect(
elementWrapper.find(`button${testSubject('~apmLogEntryActionsMenuItem')}`).prop('disabled')
elementWrapper
.find(`${testSubject('~apmLogEntryActionsMenuItem')}`)
.first()
.prop('disabled')
).toEqual(true);
});
});
Expand Down
Loading

0 comments on commit a9c510f

Please sign in to comment.