Apply memory limits
The following configuration example shows how you configure a Collector instance and its native memory limiter processor to guarantee memory allocation keeps within the specified parameters.
Demo configuration
1receivers:2 otlp:3 protocols:4 grpc:5 http:67processors:8 memory_limiter:9 check_interval: 1s10 limit_percentage: 7011 spike_limit_percentage: 301213exporters:14 otlphttp:15 endpoint: $DT_ENDPOINT/api/v2/otlp16 headers:17 Authorization: "Api-Token $DT_API_TOKEN"1819service:20 pipelines:21 traces:22 receivers: [otlp]23 processors: [memory_limiter]24 exporters: [otlphttp]25 metrics:26 receivers: [otlp]27 processors: [memory_limiter]28 exporters: [otlphttp]29 logs:30 receivers: [otlp]31 processors: [memory_limiter]32 exporters: [otlphttp]
Prerequisites
- At least Core distribution with the memory limiter processor
- The API URL of your Dynatrace environment
- An API token with the relevant access scope
Components
For our configuration, we configure the following components.
Receiver
Under receivers
, we specify the standard otlp
receiver as active receiver component for our Collector instance.
This is mainly for demonstration purposes. You can specify any other valid receiver here (for example, zipkin
).
Processor
Under processors
, we specify the memory_limiter
processor with the following parameters:
check_interval
configured to check the memory status every secondlimit_percentage
configured to allow a maximum memory allocation of 70 percentspike_limit_percentage
configured to allow a maximum spike memory usage of 20 percent
With this configuration, the Collector checks the memory allocation every second and starts to apply limits (for example, rejecting requests or forcing garbage collection) when the allocated memory exceeds 70 percent, with a temporary spike limit of 20 percent.
Exporter
Under exporters
, we specify the default otlphttp
exporter and configure it with our Dynatrace API URL and the required authentication token.
For this purpose, we set the following two environment variables and reference them in the configuration values for endpoint
and Authorization
.
DT_ENDPOINT
contains the base URL of your ActiveGate (for example,https://{your-environment-id}.live.dynatrace.com
)DT_API_TOKEN
contains the API token
Service pipeline
Under service
, we assemble our receiver and exporter objects into pipelines for traces, metrics, and logs and enable our memory limiter processor by referencing it under processors
for each respective pipeline.