You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/platform/plugins/shared/discover/public/context_awareness/README.md
+6-18Lines changed: 6 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ There are currently three context levels supported in Discover:
29
29
30
30
Discover uses a concept called "composable profiles" to support context awareness. Composable profiles are implementations of a core `Profile` interface (or a subset of it) containing all of the available extension points Discover supports. A composable profile can be implemented at any context level through a "profile provider", responsible for defining the composable profile and its associated context resolution method, called `resolve`. Each provider's `resolve` method is passed a parameters object specific to its context level, which it uses to determine if its associated `profile` is a match. In cases where it is a match, the `resolve` method also returns related metadata in a `context` object.
31
31
32
-
Within Discover there is always one resolved root profile, one resolved data source profile (as long as search results exist), and a resolved document profile for each search result in the data grid. Profile providers have access to the `context` objects of higher level providers within their `resolve` method (`root` > `data source` > `document`), making it possible to create context-dependent profiles. For example, an `oblt-logs-data-source` profile which is used when the current solution type is Observability, and the current data source contains logs data.
32
+
Within Discover there is always one resolved root profile, one resolved data source profile per Discover tab (as long as search results exist), and a resolved document profile for each search result in the data grid. Profile providers have access to the `context` objects of higher level providers within their `resolve` method (`root` > `data source` > `document`), making it possible to create context-dependent profiles. For example, an `oblt-logs-data-source` profile which is used when the current solution type is Observability, and the current data source contains logs data.
33
33
34
34
Definitions for the core `Profile` interface are located in the [`types.ts`](types.ts) file.
35
35
@@ -54,7 +54,7 @@ The context awareness framework is driven by two main supporting services called
54
54
55
55
Each context level has a dedicated profile service, e.g. `RootProfileService`, which is responsible for accepting profile provider registrations and looping over each provider in order during context resolution to identify a matching profile. Each resolution call can result in only one matching profile, which is the first to return a match based on execution order.
56
56
57
-
A single `ProfilesManager` is instantiated on Discover load, or one per Discover session panel in a dashboard. The profiles manager is responsible for the following:
57
+
A single `ProfilesManager` is instantiated on Discover load, or one per Discover session panel in a dashboard. The purpose of the main profiles manager is to resolve the root profile and instantiate a `ScopedProfilesManager` per Discover tab, which handle resolving the tab-level data source and document profiles. Together the profiles managers are responsible for the following:
58
58
59
59
- Managing state associated with the current Discover context.
60
60
- Coordinating profile services and exposing resolution methods for each context level.
@@ -64,7 +64,7 @@ A single `ProfilesManager` is instantiated on Discover load, or one per Discover
64
64
65
65
`ProfileService` definitions and implementation are located in the [`profiles_service.ts`](./profile_service.ts) file.
66
66
67
-
The `ProfilesManager`implementation is located in the [`profiles_manager.ts`](./profiles_manager.ts)file.
67
+
The `ProfilesManager`and `ScopedProfilesManager` implementations are located in the [`profiles_manager.ts`](./profiles_manager/profiles_manager.ts)and [`scoped_profiles_manager.ts`](./profiles_manager/scoped_profiles_manager.ts) files.
68
68
69
69
### Putting it all together
70
70
@@ -95,7 +95,7 @@ By ensuring all Discover profiles use the same IoC mechanism, changes or improve
95
95
In order to register a Discover profile, follow these steps:
96
96
97
97
1. Identify at which [context level](#context-levels) your profile should be implemented.
98
-
2. Create a subfolder for your profile provider within the [`profile_providers`](./profile_providers) folder. Common Discover providers should be created within the `profile_providers/common` subfolder, while solution specific providers should be created within a `profile_providers/{SOLUTION_TYPE}` subfolder, e.g. `profile_providers/security/security_root_profile`.
98
+
2. Create a subfolder for your profile provider within the [`profile_providers`](./profile_providers) folder. Common Discover providers should be created within the `profile_providers/common` subfolder, while solution specific providers should be created within a `profile_providers/{SOLUTION_TYPE}` subfolder, e.g. `profile_providers/security`. Subfolder names for individual providers should indicate their context level for clarity, e.g. `profile_providers/security/security_root_profile`.
99
99
3. Create a `profile.ts(x)` file within your provider subfolder that exports a factory function which optionally accepts a `ProfileProviderServices` parameter and returns your provider implementation, e.g. `createSecurityRootProfileProvider(services: ProfileProviderServices) => RootProfileProvider`.
100
100
4.**If your provider is not ready for GA or should only be enabled for specific configurations, make sure to set the `isExperimental` flag to `true` in your profile provider.** This will ensure the profile is disabled by default, and can be enabled in `kibana.yml` like this: `discover.experimental.enabledProfiles: [{YOUR_PROFILE_ID}]`.
101
101
5. Call and return the result of your provider factory function from the corresponding factory function in [`register_profile_providers.ts`](./profile_providers/register_profile_providers.ts), e.g. `createRootProfileProviders`. The order of providers in the returned array determines the execution order during context resolution.
@@ -113,11 +113,9 @@ Example profile provider implementations are located in [`profile_providers/exam
Copy file name to clipboardExpand all lines: src/platform/plugins/shared/discover/public/context_awareness/profile_providers/example/example_data_source_profile/profile.tsx
0 commit comments