Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap profiling indices at startup #95666

Merged
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1ea4623
Bootstrap profiling indices at startup
danielmitterdorfer Apr 27, 2023
a3e92dd
Use IndexTemplateRegistry
danielmitterdorfer May 2, 2023
2c76e0e
Temporarily disable profiling by default
danielmitterdorfer May 2, 2023
5cfd210
Merge remote-tracking branch 'origin/main' into profiling-idx-bootstrap
danielmitterdorfer May 2, 2023
0cb1a58
Use hidden / versioned indices
danielmitterdorfer May 2, 2023
1ae1012
Port comments in index templates
danielmitterdorfer May 2, 2023
4e0bb38
Port profiling-metrics
danielmitterdorfer May 2, 2023
1f45542
Add test
danielmitterdorfer May 3, 2023
ee183f7
Merge branch 'main' into profiling-idx-bootstrap
elasticmachine May 4, 2023
72b0698
Add test for ProfilingIndexManager
danielmitterdorfer May 5, 2023
485d5e1
Merge remote-tracking branch 'origin/main' into profiling-idx-bootstrap
danielmitterdorfer May 5, 2023
62aad06
More robust precondition check in integration tests
danielmitterdorfer May 5, 2023
6de3263
Update docs/changelog/95666.yaml
danielmitterdorfer May 5, 2023
8b2ecef
Introduce xpack.profiling.templates.enabled
danielmitterdorfer May 8, 2023
8c951e5
Disable profiling in more tests
danielmitterdorfer May 8, 2023
9428492
Disable profiling in more tests
danielmitterdorfer May 8, 2023
20d2e18
Tweak tests, use auto expand replicas
danielmitterdorfer May 8, 2023
a551d49
Ignore profiling templates in REST tests
danielmitterdorfer May 8, 2023
078ea02
Make the linter happy
danielmitterdorfer May 8, 2023
74f4fca
Take advantage of auto expand replicas in test
danielmitterdorfer May 8, 2023
508ecd5
Remove profiling plugin where unknown
danielmitterdorfer May 8, 2023
0bce6eb
Adjust tests
danielmitterdorfer May 9, 2023
cc33ae1
Amend docs about full cluster restore
danielmitterdorfer May 9, 2023
d6655ad
Disable profiling only for 8.7.0+
danielmitterdorfer May 9, 2023
423d2d9
Adjust watcher tests
danielmitterdorfer May 9, 2023
6243891
Add missing snippet end in docs
danielmitterdorfer May 9, 2023
f7e9fec
More fixes
danielmitterdorfer May 10, 2023
8796069
Merge remote-tracking branch 'origin/main' into profiling-idx-bootstrap
danielmitterdorfer May 10, 2023
67488a9
Disable profiling only for 8.7.0+
danielmitterdorfer May 10, 2023
7100f06
Wait for cluster state updates to finish
danielmitterdorfer May 10, 2023
bd7eee0
Fix formatting
danielmitterdorfer May 10, 2023
66c4965
More fixes
danielmitterdorfer May 10, 2023
896b752
Disable profiling in repo metering QA tests
danielmitterdorfer May 10, 2023
a86ee38
Merge branch 'main' into profiling-idx-bootstrap
elasticmachine May 10, 2023
a9a1eb5
Preliminary fix for #87001
danielmitterdorfer May 11, 2023
341c57f
Revert "Preliminary fix for #87001"
danielmitterdorfer May 11, 2023
bf85f1c
Merge remote-tracking branch 'origin/main' into profiling-idx-bootstrap
danielmitterdorfer May 11, 2023
f2e7c02
Disable index template management by default
danielmitterdorfer May 12, 2023
c9ffb25
Restore unintentional whitespace changes
danielmitterdorfer May 12, 2023
d0fdd70
Use list continuation in docs
danielmitterdorfer May 12, 2023
7dc6f1c
Address review comments
danielmitterdorfer May 16, 2023
f1dee21
Address review comments
danielmitterdorfer May 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/95666.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 95666
summary: Bootstrap profiling indices at startup
area: Indices APIs
type: enhancement
issues: []
42 changes: 39 additions & 3 deletions docs/reference/snapshot-restore/restore-snapshot.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ snapshot as well as each feature's indices.

To restore a specific feature state from the snapshot, specify the
`feature_name` from the response in the restore snapshot API's
<<restore-snapshot-api-feature-states,`feature_states`>> parameter.
<<restore-snapshot-api-feature-states,`feature_states`>> parameter.

NOTE: When you restore a feature state, {es} closes and overwrites the feature's existing indices.

Expand All @@ -247,7 +247,7 @@ realm>> to ensure you'll still be able to access your cluster.
POST _snapshot/my_repository/my_snapshot_2099.05.06/_restore
{
"feature_states": [ "geoip" ],
"include_global_state": false, <1>
"include_global_state": false, <1>
"indices": "-*" <2>
}
----
Expand All @@ -256,7 +256,7 @@ POST _snapshot/my_repository/my_snapshot_2099.05.06/_restore
// TEST[s/_restore/_restore?wait_for_completion=true/]
// TEST[s/"feature_states": \[ "geoip" \],//]

<1> Exclude the cluster state from the restore operation.
<1> Exclude the cluster state from the restore operation.
<2> Exclude the other indices and data streams in the snapshot from the restore operation.

[discrete]
Expand Down Expand Up @@ -365,6 +365,27 @@ POST _watcher/_start
. {blank}
+
--
* Universal Profiling
+
Check if Universal Profiling index template management is enabled:
+
[source,console]
----
GET /_cluster/settings?filter_path=**.xpack.profiling.templates.enabled&include_defaults=true
----
+
If the value is `true`, disable Universal Profiling index template management:
+
[source,console]
----
PUT _cluster/settings
{
"persistent": {
"xpack.profiling.templates.enabled": false
}
}
----

[[restore-create-file-realm-user]]
If you use {es} security features, log in to a node host, navigate to the {es}
installation directory, and add a user with the `superuser` role to the file
Expand Down Expand Up @@ -480,6 +501,21 @@ POST _watcher/_start
----
--

* Universal Profiling
+
If the value was `true` initially, enable Universal Profiling index template management again, otherwise skip this step:
+
[source,console]
----
PUT _cluster/settings
{
"persistent": {
"xpack.profiling.templates.enabled": true
}
}
----
//TEST[s/true/false/]

. If wanted, reset the `action.destructive_requires_name` cluster setting.
+
[source,console]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ protected Set<String> preserveILMPolicyIds() {
"ml-size-based-ilm-policy",
"logs",
"metrics",
"profiling",
"synthetics",
"7-days-default",
"30-days-default",
Expand Down Expand Up @@ -1814,11 +1815,15 @@ protected static boolean isXPackTemplate(String name) {
if (name.startsWith("behavioral_analytics-")) {
return true;
}
if (name.startsWith("profiling-")) {
return true;
}
switch (name) {
case ".watches":
case "security_audit_log":
case ".slm-history":
case ".async-search":
case ".profiling-ilm-lock": // TODO: Remove after switch to K/V indices
case "saml-service-provider":
case "logs":
case "logs-settings":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ private static String maybeRewriteSingleAuthenticationHeaderForVersion(
public static final String TRANSFORM_ORIGIN = "transform";
public static final String ASYNC_SEARCH_ORIGIN = "async_search";
public static final String IDP_ORIGIN = "idp";
public static final String PROFILING_ORIGIN = "profiling";
public static final String STACK_ORIGIN = "stack";
public static final String SEARCHABLE_SNAPSHOTS_ORIGIN = "searchable_snapshots";
public static final String LOGSTASH_MANAGEMENT_ORIGIN = "logstash_management";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ public Iterator<Setting<?>> settings() {
Setting.Property.NodeScope
);

/** Setting for enabling or disabling universal profiling. Defaults to true. */
public static final Setting<Boolean> PROFILING_ENABLED = Setting.boolSetting(
"xpack.profiling.enabled",
true,
Setting.Property.NodeScope
);

/** Setting for enabling or disabling enterprise search. Defaults to true. */
public static final Setting<Boolean> ENTERPRISE_SEARCH_ENABLED = Setting.boolSetting(
"xpack.ent_search.enabled",
Expand Down Expand Up @@ -318,6 +325,7 @@ public static List<Setting<?>> getAllSettings() {
settings.add(SECURITY_ENABLED);
settings.add(GRAPH_ENABLED);
settings.add(MACHINE_LEARNING_ENABLED);
settings.add(PROFILING_ENABLED);
settings.add(ENTERPRISE_SEARCH_ENABLED);
settings.add(AUDIT_ENABLED);
settings.add(WATCHER_ENABLED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.elasticsearch.xpack.core.ilm.LifecyclePolicyUtils;
import org.elasticsearch.xpack.core.ilm.LifecycleType;
import org.elasticsearch.xpack.core.ilm.RolloverAction;
import org.elasticsearch.xpack.core.ilm.SetPriorityAction;
import org.elasticsearch.xpack.core.ilm.ShrinkAction;
import org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType;

Expand All @@ -36,6 +37,7 @@ public class LifecyclePolicyConfig {
(p) -> TimeseriesLifecycleType.INSTANCE
),
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(RolloverAction.NAME), RolloverAction::parse),
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(SetPriorityAction.NAME), SetPriorityAction::parse),
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ForceMergeAction.NAME), ForceMergeAction::parse),
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(ShrinkAction.NAME), ShrinkAction::parse),
new NamedXContentRegistry.Entry(LifecycleAction.class, new ParseField(DeleteAction.NAME), DeleteAction::parse)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{
"settings": {
"index": {
"number_of_shards": "4",
"max_result_window": 150000,
"refresh_interval": "10s",
"sort": {
"field": [
"service.name",
"@timestamp",
"orchestrator.resource.name",
"container.name",
"process.thread.name",
"host.id"
]
}
"template": {
"settings": {
"index": {
"number_of_shards": 4,
"number_of_replicas": 0,
"auto_expand_replicas": "0-1",
"max_result_window": 150000,
"refresh_interval": "10s",
"sort": {
"field": [
"service.name",
"@timestamp",
"orchestrator.resource.name",
"container.name",
"process.thread.name",
"host.id"
]
}
},
"codec": "best_compression"
},
"codec": "best_compression"
},
"mappings": {
"_doc": {
"mappings": {
"_source": {
"enabled": false
},
Expand Down Expand Up @@ -60,9 +62,6 @@
"host.ip": {
"type": "ip"
},
"host.ipstring": {
"type": "keyword"
},
"host.name": {
"type": "keyword"
},
Expand All @@ -74,5 +73,6 @@
}
}
}
}
},
"version": ${xpack.profiling.template.version}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"settings": {
"index": {
"refresh_interval": "10s"
}
},
"mappings": {
"_doc": {
"template": {
"settings": {
"index": {
"number_of_replicas": 0,
"auto_expand_replicas": "0-1",
"refresh_interval": "10s"
}
},
"mappings": {
"_source": {
"mode": "synthetic"
},
Expand All @@ -25,8 +27,14 @@
"@timestamp": {
"type": "date",
"format": "epoch_second"
},
"Symbolization.lastprocessed": {
"type": "date",
"format": "epoch_second",
"index": false
}
}
}
}
},
"version": ${xpack.profiling.template.version}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "profiling"
}
}
}
},
"version": ${xpack.profiling.template.version}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"template": {
"settings": {
"index": {
"number_of_replicas": 0,
"auto_expand_replicas": "0-1",
"refresh_interval": "10s",
"sort": {
"field": [
"project.id",
"@timestamp",
"host.id"
]
}
},
"codec": "best_compression"
},
"mappings": {
"_source": {
"enabled": false
},
"properties": {
"ecs.version": {
"type": "keyword",
"index": true
},
"project.id": {
"type": "keyword"
},
"host.id": {
"type": "keyword"
},
"@timestamp": {
"type": "date",
"format": "epoch_second"
},
"Elasticsearch.cluster.id": {
"type": "keyword"
}
}
}
},
"version": ${xpack.profiling.template.version}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"settings": {
"index": {
"number_of_shards": "16",
"refresh_interval": "10s"
}
},
"mappings": {
"_doc": {
"template": {
"settings": {
"index": {
"number_of_shards": 16,
"number_of_replicas": 0,
"auto_expand_replicas": "0-1",
"refresh_interval": "10s"
}
},
"mappings": {
"_source": {
"enabled": true
},
Expand Down Expand Up @@ -34,8 +36,15 @@
"index": false,
"doc_values": false,
"store": false
},
"Stackframe.function.offset": {
"type": "integer",
"index": false,
"doc_values": false,
"store": false
}
}
}
}
},
"version": ${xpack.profiling.template.version}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"settings": {
"index": {
"number_of_shards": "16",
"refresh_interval": "10s",
"sort": {
"field": [
"Stacktrace.frame.ids"
]
"template": {
"settings": {
"index": {
"number_of_shards": 16,
"number_of_replicas": 0,
"auto_expand_replicas": "0-1",
"refresh_interval": "10s",
"sort": {
"field": [
"Stacktrace.frame.ids"
]
}
}
}
},
"mappings": {
"_doc": {
},
"mappings": {
"_source": {
"mode": "synthetic"
},
Expand All @@ -27,12 +29,9 @@
"Stacktrace.frame.types": {
"type": "keyword",
"index": false
},
"@timestamp": {
"type": "date",
"format": "epoch_second"
}
}
}
}
},
"version": ${xpack.profiling.template.version}
}
Loading