Skip to content

Commit 4bd47a0

Browse files
[observability] [apm] Document additional privileges for tail-based sampling (#1065)
Closes https://github.com/elastic/observability-docs/issues/4718 Documents the additional privileges needed when using tail-based sampling. This is just my initial attempt based on @bmorelli25's [comment](https://github.com/elastic/observability-docs/issues/4718#issuecomment-2568550011). @endorama can you take a look? --------- Co-authored-by: Mike Birnstiehl <114418652+mdbirnstiehl@users.noreply.github.com>
1 parent cdb2cd5 commit 4bd47a0

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

solutions/observability/apm/create-assign-feature-roles-to-apm-server-users.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ applies_to:
1010

1111
::::{note}
1212
Kibana custom roles are *not* compatible with [{{serverless-full}}](https://docs.elastic.co/serverless).
13-
1413
::::
1514

1615
Manage access on a feature-by-feature basis by creating several custom feature-related *roles* and assigning one or more of these roles to each *user or group* based on which features they need to access.
@@ -23,7 +22,6 @@ In general, there are three types of privileges you’ll work with when creating
2322
* **{{es}} cluster privileges**: Manage the actions a user can perform against your cluster.
2423
* **{{es}} index privileges**: Control access to the data in specific indices of your cluster.
2524
* **{{kib}} space privileges**: Grant users write or read access to features and apps within {{kib}}.
26-
2725
::::
2826

2927
The following are common roles that APM Server users might need:
@@ -32,14 +30,14 @@ The following are common roles that APM Server users might need:
3230
* [**Central configuration management role**](#apm-privileges-agent-central-config): Allows a user to view APM Agent central configurations, which is **required** when [central configuration management](/solutions/observability/apm/apm-agent-central-configuration.md) is enabled (it is enabled by default).
3331
* [**Monitoring role**](#apm-privileges-to-publish-monitoring): Allows a user to publish monitoring data, view monitoring data, or both.
3432
* [**RUM source mapping role**](#apm-privileges-rum-source-mapping): Allows a user to read RUM source maps.
33+
* [**Tail-based sampling role**](#apm-privileges-tail-based-sampling): Allows a user to use [tail-based sampling](/solutions/observability/apm/transaction-sampling.md#apm-tail-based-sampling).
3534

3635
::::{admonition} Example: Assigning multiple roles to an APM Server user
3736
If you want to create an APM Server user who can use the Elastic APM Real User Monitoring (RUM) JavaScript Agent to ingest data from a frontend application and you use central configuration to manage APM agents, you would need to assign these three roles to the user:
3837

3938
* [Writer role](#apm-privileges-to-publish-events)
4039
* [Central configuration management role](#apm-privileges-agent-central-config)
4140
* [RUM source mapping role](#apm-privileges-rum-source-mapping)
42-
4341
::::
4442

4543
## Create a *writer* role [apm-privileges-to-publish-events]
@@ -48,7 +46,6 @@ APM users that publish events to {{es}} *must* have privileges to write to APM d
4846

4947
::::{note}
5048
This is not needed when APM Server doesn’t write to {{es}} directly. For example, in some cases you may configure APM Server to write to another output like Logstash, Kafka, or any other output supported by libbeat. In these cases, different authentication credentials will need to be passed to [`apm-server.agent.config.elasticsearch`](/solutions/observability/apm/configure-apm-agent-central-configuration.md#apm-agent-config-elasticsearch).
51-
5249
::::
5350

5451
To grant an APM Server user the required privileges for writing events to {{es}}:
@@ -69,7 +66,6 @@ If you have explicitly disabled Elastic security *and* you are *not* using tail-
6966

7067
::::{note}
7168
Assign additional APM feature roles to users as needed including the *Central configuration management role*, which is [required in most cases](#apm-central-config-role-note).
72-
7369
::::
7470

7571
## Create a *central configuration management* role [apm-privileges-agent-central-config]
@@ -78,7 +74,6 @@ Assign additional APM feature roles to users as needed including the *Central co
7874
:name: apm-central-config-role-note
7975

8076
The privileges included in this role are **required** for all users when [central configuration management](/solutions/observability/apm/apm-agent-central-configuration.md) is enabled (it is enabled by default). You need this role unless central configuration management has been explicitly disabled in the Applications UI.
81-
8277
::::
8378

8479
$$$apm-privileges-agent-central-config-server$$$
@@ -108,7 +103,6 @@ The previous privileges should be sufficient for APM agent central configuration
108103

109104
::::{note}
110105
Assign additional APM feature roles to users as needed including the *Writer role*, which is [required in most cases](#apm-privileges-to-publish-events).
111-
112106
::::
113107

114108
::::{tip}
@@ -130,7 +124,6 @@ Looking for privileges and roles needed to use central configuration from the Ap
130124

131125
::::{important}
132126
**{{ecloud}} users:** This section does not apply to [{{ech}}](https://www.elastic.co/cloud/elasticsearch-service). Monitoring on {{ecloud}} is enabled by clicking the **Enable** button in the **Monitoring** panel.
133-
134127
::::
135128

136129
#### Internal collection [apm-privileges-to-publish-monitoring-internal]
@@ -161,7 +154,6 @@ If you don’t use the `apm_system` user, you can create a custom role:
161154

162155
::::{note}
163156
Assign additional APM feature roles to users as needed including the [*Writer role*](#apm-privileges-to-publish-events) and [*Central configuration management role*](#apm-central-config-role-note), both of which are required in most cases.
164-
165157
::::
166158

167159
#### {{metricbeat}} collection [apm-privileges-to-publish-monitoring-metricbeat]
@@ -194,7 +186,6 @@ If you don’t use the `remote_monitoring_user` user, you can create a custom us
194186

195187
::::{note}
196188
Assign additional APM feature roles to users as needed including the [*Writer role*](#apm-privileges-to-publish-events) and [*Central configuration management role*](#apm-central-config-role-note), both of which are required in most cases.
197-
198189
::::
199190

200191
### View monitoring data [apm-privileges-to-publish-monitoring-view]
@@ -216,7 +207,6 @@ To grant users the required privileges for viewing monitoring data:
216207

217208
::::{note}
218209
Assign additional APM feature roles to users as needed including the [*Writer role*](#apm-privileges-to-publish-events) and [*Central configuration management role*](#apm-central-config-role-note), both of which are required in most cases.
219-
220210
::::
221211

222212
## Create a *source map* role [apm-privileges-rum-source-map]
@@ -232,7 +222,20 @@ To grant an APM Server user with the required privileges for reading RUM source
232222

233223
::::{note}
234224
Assign additional APM feature roles to users as needed including the [*Writer role*](#apm-privileges-to-publish-events) and [*Central configuration management role*](#apm-central-config-role-note), both of which are required in most cases.
235-
236225
::::
237226

238-
The previous privileges should be sufficient for RUM source mapping to work properly as long as APM Server communicates with {{es}} successfully. If it fails, it may fallback to read source maps through {{kib}} if configured, which requires additional {{kib}} privileges. For more details, refer to the [{{stack}}](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-apm-sourcemaps) or [{{serverless-short}}](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-apm-sourcemaps) API documentation.
227+
The previous privileges should be sufficient for RUM source mapping to work properly as long as APM Server communicates with {{es}} successfully. If it fails, it may fallback to read source maps through {{kib}} if configured, which requires additional {{kib}} privileges. For more details, refer to the [{{stack}}](https://www.elastic.co/docs/api/doc/kibana/group/endpoint-apm-sourcemaps) or [{{serverless-short}}](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-apm-sourcemaps) API documentation.
228+
229+
## Create a *tail-based sampling* role [apm-privileges-tail-based-sampling]
230+
231+
If [tail-based sampling](/solutions/observability/apm/tail-based-sampling.md) is enabled, the user will need additional privileges.
232+
233+
APM Server users need the following privileges to read tail-based sampling indices from {{es}}:
234+
235+
| Type | Privilege | Purpose |
236+
| --- | --- | --- |
237+
| Index | `read` on `traces-apm.sampled` index | Allow APM Server to read tail-based sampling indices from {{es}} |
238+
239+
::::{note}
240+
Assign additional APM feature roles to users as needed including the [*Writer role*](#apm-privileges-to-publish-events) and [*Central configuration management role*](#apm-central-config-role-note), both of which are required in most cases.
241+
::::

solutions/observability/apm/grant-access-using-api-keys.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ To create an API key:
5656
"allow_restricted_indices": true
5757
}
5858
]
59+
},
60+
"apm_tail_based_sampling": {
61+
"index": [
62+
{
63+
"names": ["traces-apm.sampled"],
64+
"privileges": ["read"]
65+
}
66+
]
5967
}
6068
}
6169
```
@@ -156,6 +164,14 @@ POST /_security/api_key
156164
"allow_restricted_indices": true
157165
}
158166
]
167+
},
168+
"apm_tail_based_sampling": {
169+
"index": [
170+
{
171+
"names": ["traces-apm.sampled"],
172+
"privileges": ["read"]
173+
}
174+
]
159175
}
160176
}
161177
}

solutions/observability/apm/tail-based-sampling.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ applies_to:
1111
![supported deployment methods](/solutions/images/observability-binary-yes-fm-yes.svg "")
1212

1313
Most options on this page are supported by all APM Server deployment methods when writing to {{es}}. If you are using a different [output](/solutions/observability/apm/configure-output.md), tail-based sampling is *not* supported.
14+
::::
1415

16+
::::{note}
17+
Enhanced privileges are required to use tail-based sampling. For more information, refer to [Create a tail-based sampling role](/solutions/observability/apm/create-assign-feature-roles-to-apm-server-users.md#apm-privileges-tail-based-sampling).
1518
::::
1619

1720
Tail-based sampling configuration options.

solutions/observability/apm/transaction-sampling.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ serverless: unavailable
112112
**Support for tail-based sampling**
113113

114114
Tail-based sampling is only supported when writing to {{es}}. If you are using a different [output](/solutions/observability/apm/configure-output.md), tail-based sampling is *not* supported.
115-
116115
::::
117116

118117
In tail-based sampling, the sampling decision for each trace is made after the trace has completed. This means all traces will be analyzed against a set of rules, or policies, which will determine the rate at which they are sampled.
@@ -261,6 +260,10 @@ stack:
261260
serverless: unavailable
262261
```
263262

263+
::::{note}
264+
Enhanced privileges are required to use tail-based sampling. For more information, refer to [Create a tail-based sampling role](/solutions/observability/apm/create-assign-feature-roles-to-apm-server-users.md#apm-privileges-tail-based-sampling).
265+
::::
266+
264267
Enable tail-based sampling with [Enable tail-based sampling](/solutions/observability/apm/tail-based-sampling.md#sampling-tail-enabled-ref). When enabled, trace events are mapped to sampling policies. Each sampling policy must specify a sample rate, and can optionally specify other conditions. All of the policy conditions must be true for a trace event to match it.
265268

266269
Trace events are matched to policies in the order specified. Each policy list must conclude with a default policy — one that only specifies a sample rate. This default policy is used to catch remaining trace events that don’t match a stricter policy. Requiring this default policy ensures that traces are only dropped intentionally. If you enable tail-based sampling and send a transaction that does not match any of the policies, APM Server will reject the transaction with the error `no matching policy`.

0 commit comments

Comments
 (0)