APM Server 二进制文件
Elastic Stack
本指南将说明如何设置和配置 APM Server 二进制文件。
首先,请参阅 Elastic 支持矩阵,了解有关支持的操作系统和产品兼容性的信息。
您需要
- 用于存储和索引数据的 Elasticsearch。
- 用于使用 Applications UI 可视化的 Kibana。
我们建议您使用相同版本的 Elasticsearch、Kibana 和 APM Server。有关安装这些产品的更多信息,请参阅 安装 Elastic Stack。

开始之前:如果您尚未安装 Elastic Stack,请立即安装。请参阅 了解如何在您自己的硬件上安装 Elastic Stack。
要下载和安装 APM Server,请使用以下适用于您系统的命令。如果您使用 apt
或 yum
,您可以 从我们的存储库安装 APM Server,以便更轻松地更新到最新版本。
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-9.0.0-amd64.deb
sudo dpkg -i apm-server-9.0.0-amd64.deb
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-9.0.0-x86_64.rpm
sudo rpm -vi apm-server-9.0.0-x86_64.rpm
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-9.0.0-linux-x86_64.tar.gz
tar xzvf apm-server-9.0.0-linux-x86_64.tar.gz
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-9.0.0-darwin-x86_64.tar.gz
tar xzvf apm-server-9.0.0-darwin-x86_64.tar.gz
从 下载页面 下载 APM Server Windows zip 文件。
将 zip 文件的内容解压缩到
C:\Program Files
中。将
apm-server-<version>-windows
目录重命名为APM-Server
。以管理员身份打开 PowerShell 提示符(右键单击 PowerShell 图标并选择 以管理员身份运行)。如果您运行的是 Windows XP,则可能需要下载并安装 PowerShell。
从 PowerShell 提示符处,运行以下命令以将 APM Server 安装为 Windows 服务
有关部署 Docker 容器,请参阅 在 Docker 上运行。
通过编辑 apm-server.yml
配置文件来配置 APM。此文件的位置因平台而异——请参阅 安装布局 以获取帮助。
一个最小的配置文件可能如下所示
apm-server:
host: "localhost:8200"
output.elasticsearch:
hosts: ["localhost:9200"]
username: "elastic"
password: "changeme"
- APM Server 侦听的
host:port
。 - 要连接到的 Elasticsearch
host:port
。 - 此示例使用基本身份验证。此处提供的用户需要具有将事件发布到 Elasticsearch 所需的权限。要为此角色创建专用用户,请参阅 创建写入者角色。
所有可用的配置选项都在 配置 APM Server 中进行了概述。
在生产环境中,您会将 APM Server 放在自己的机器上,类似于您运行 Elasticsearch 的方式。您可以在与 Elasticsearch 相同的机器上运行它,但不建议这样做,因为这些进程将争夺资源。
要启动 APM Server,请运行
./apm-server -e
-e
全局标志 启用对 stderr 的日志记录并禁用 syslog/文件输出。如果您已在配置文件中启用日志记录,请删除此标志。对于 Linux 系统,请参阅 APM Server 状态和日志。
您应该看到 APM Server 启动。它将尝试连接到 localhost 端口 9200
上的 Elasticsearch,并公开端口 8200
上的代理 API。您可以在 apm-server.yml
中更改默认值,或者在命令行上提供不同的地址
./apm-server -e -E output.elasticsearch.hosts=ElasticsearchAddress:9200 -E apm-server.host=localhost:8200
对于 Debian 软件包和 RPM 安装,我们建议 apm-server
进程以非 root 用户身份运行。因此,这些安装方法会创建一个 apm-server
用户,您可以用来启动该进程。此外,只有当配置文件 归运行该进程的用户所有 时,APM Server 才会启动。
在这种情况下,要启动 APM Server,请运行
sudo -u apm-server apm-server [<argument...>]
默认情况下,APM Server 从 /etc/apm-server/apm-server.yml
加载其配置文件。有关完整的目录布局,请参阅 deb & rpm 默认路径。
1. 将代理添加到您的项目
首先,将 Elastic APM 代理插件 添加到应用程序的 build.gradle
文件中,如下所示
// Android app's build.gradle file
plugins {
id "com.android.application"
id "co.elastic.apm.android" version "[latest_version]"
}
- Elastic 插件声明必须添加到 Android 应用程序插件声明 (
com.android.application
) 和 Kotlin 插件声明(如果使用)下方。
2. 配置代理
添加代理插件后,对其进行配置。最小配置设置 Elastic APM 集成端点,如下所示
// Android app's build.gradle file
plugins {
//...
id "co.elastic.apm.android" version "[latest_version]"
}
elasticApm {
// Minimal configuration
serverUrl = "https://your.elastic.server"
// Optional
serviceName = "your app name"
serviceVersion = "0.0.0"
apiKey = "your server api key"
secretToken = "your server auth token"
}
- 您可以在 Gradle 插件门户 中找到最新版本。
- 默认为您的
android.defaultConfig.applicationId
值。 - 默认为您的
android.defaultConfig.versionName
值。 - 默认为 null。有关 API 密钥的更多信息,请参见 此处。
- 默认为 null。
当同时提供 secretToken
和 apiKey
时,apiKey 具有优先级,并且 secretToken 被忽略。
3. 初始化代理
在将您的项目与上述 Gradle 更改同步后,需要在您的 Application 类 中初始化 Elastic APM 代理。此示例显示了配置代理的最简单方法
// Your Application class
class MyApp extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
ElasticApmAgent.initialize(this);
}
}
- 初始化 Elastic APM 代理一次。
剩下的就是编译并运行您的应用程序。就是这样!
在代理参考中了解更多信息
请在 APM Android 代理参考 中阅读更多信息。
1. 安装代理
使用 go get
安装 Elastic APM Go 代理软件包
go get -u go.elastic.co/apm/v2
2. 配置代理
为了简化开发和测试,该代理默认将数据发送到 http://localhost:8200
上的 Elastic APM 集成。要将数据发送到其他位置,您必须配置 ELASTIC_APM_SERVER_URL
。
# The APM integration host and port
export ELASTIC_APM_SERVER_URL=
# If you do not specify `ELASTIC_APM_SERVICE_NAME`, the Go agent will use the
# executable name. For example, if your executable is called "my-app.exe", then your
# service will be identified as "my-app".
export ELASTIC_APM_SERVICE_NAME=
# Secret tokens are used to authorize requests to the APM integration
export ELASTIC_APM_SECRET_TOKEN=
3. 监测您的应用程序
监测是扩展您的应用程序代码以将跟踪数据报告给 Elastic APM 的过程。Go 应用程序必须在源代码级别手动监测。要监测您的应用程序,请使用以下方法之一
在代理参考中了解更多信息
1. 将代理依赖项添加到您的项目
将 Elastic APM iOS 代理添加到您的 Xcode 项目或您的 Package.swift
中。
以下是将 程序包依赖项 添加到标准 Xcode 项目的说明。
有关将依赖项添加到您的 Package.swift
的详细信息,请参阅 添加对另一个 Swift 程序包的依赖。这是一个有用的代码片段
Package(
dependencies:[
.package(name: "apm-agent-ios", url: "https://github.com/elastic/apm-agent-ios.git", from: "1.0.0"),
],
targets:[
.target(
name: "MyApp",
dependencies: [
.product(name: "ElasticApm", package: "apm-agent-ios")
]
),
])
2. 初始化代理
如果您使用 SwiftUI
构建您的应用程序,请将以下内容添加到您的 App.swift
import SwiftUI
import ElasticApm
class AppDelegate : NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
var config = AgentConfigBuilder()
.withServerUrl(URL(string:"http://127.0.0.1:8200"))
.withSecretToken("<SecretToken>")
.build()
ElasticApmAgent.start(with: config)
return true
}
}
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
init() {
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
- APM 集成主机和端口
- 用于 APM 集成连接的密钥令牌
如果您不使用 SwiftUI
,您也可以将相同的内容添加到您的 AppDelegate.swift
文件
import UIKit
import ElasticApm
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
var config = AgentConfigBuilder()
.withServerUrl(URL(string:"http://127.0.0.1:8200"))
.withSecretToken("<SecretToken>")
.build()
ElasticApmAgent.start(with: config)
return true
}
}
- APM 集成主机和端口
- 用于 APM 集成连接的密钥令牌
在代理参考中了解更多信息
请在 APM iOS 代理参考 中阅读更多信息。
使用 -javaagent
JVM 选项手动设置和配置代理。不需要更改应用程序代码,但这需要重新启动应用程序。有关此设置方法的更多信息,请参见下文。
1. 下载 APM 代理
开始使用 Elastic APM Java 代理的第一步是检索代理 JAR 的副本。Java 代理版本发布到 Maven central。为了获取副本,您可以
使用
curl
下载curl -o 'elastic-apm-agent.jar' -L 'https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=co.elastic.apm&a=elastic-apm-agent&v=LATEST'
2. 添加 -javaagent
标志
启动您的应用程序时,添加 JVM 标志 -javaagent:/path/to/elastic-apm-agent-<version>.jar
3. 配置
不同的应用服务器有不同的设置 -javaagent
标志和系统属性的方法。启动您的应用程序(例如 Spring Boot 应用程序或其他嵌入式服务器),并添加 -javaagent
JVM 标志。使用 -D
前缀通过系统属性配置 Agent。
java -javaagent:/path/to/elastic-apm-agent-<version>.jar -Delastic.apm.service_name=my-cool-service -Delastic.apm.application_packages=org.example,org.another.example -Delastic.apm.server_url=http://127.0.0.1:8200 -jar my-application.jar
请参阅使用 -javaagent
标志手动设置以了解更多信息。
其他设置方法
- 使用
apm-agent-attach-cli.jar
自动设置
无需更改 JVM 或应用服务器的配置即可自动设置 Agent。此方法无需更改应用程序代码或 JVM 选项,并允许附加到正在运行的 JVM。有关此设置方法的更多信息,请参阅Java Agent 文档。 - 用于自附加的编程 API 设置
通过一行代码更改和一个额外的apm-agent-attach
依赖项来设置 Agent。此方法无需更改 JVM 选项,并且 Agent 工件嵌入在打包的应用程序二进制文件中。有关此设置方法的更多信息,请参阅Java Agent 文档。
设置 APM Agent
可以通过几种不同的方式将 .NET Agent 添加到应用程序中
- 分析器运行时检测:该 Agent 支持自动检测,无需任何代码更改,也无需重新编译您的项目。请参阅分析器自动检测。
- NuGet 包:该 Agent 以一组 NuGet 包 的形式提供,这些包可在 nuget.org 上获得。您可以通过引用这些包中的一个或多个并遵循包文档,将 Agent 和特定的检测添加到 .NET 应用程序。
- 主机启动钩子:在 .NET Core 3.0+ 或 .NET 5+ 上,该 Agent 支持自动检测,无需任何代码更改,也无需重新编译您的项目。有关更多详细信息,请参阅.NET Core 上的零代码更改设置。
在代理参考中了解更多信息
1. 安装 APM Agent
将 Node.js 的 APM Agent 作为依赖项安装到您的应用程序中。
npm install elastic-apm-node --save
2. 初始化
重要的是,在您要求 Node.js 应用程序中的 **任何** 其他模块之前启动 Agent - 即在 http
之前,以及在您的路由器等之前。
这意味着您可能应该在应用程序的主文件中(通常是 index.js
、server.js
或 app.js
)要求并启动 Agent。
这是一个关于 Elastic APM 通常如何被请求和启动的简单示例
// Add this to the VERY top of the first file loaded in your app
var apm = require('elastic-apm-node').start({
// Override service name from package.json
// Allowed characters: a-z, A-Z, 0-9, -, _, and space
serviceName: '',
// Use if APM integration requires a token
secretToken: '',
// Use if APM integration uses API keys for authentication
apiKey: '',
// Set custom APM integration host and port (default: http://127.0.0.1:8200)
serverUrl: '',
})
Agent 现在将监视您的应用程序的性能并记录任何未捕获的异常。
在代理参考中了解更多信息
1. 安装代理
使用受支持平台的软件包之一安装 Agent。
使用 RPM 包 (RHEL/CentOS 和 Fedora)
rpm -ivh <package-file>.rpm
使用 DEB 包(Debian 和 Ubuntu)
dpkg -i <package-file>.deb
使用 APK 包 (Alpine)
apk add --allow-untrusted <package-file>.apk
如果您找不到您的发行版,您可以通过从源代码构建来安装 Agent。以下说明将使用 Elastic 用于构建官方软件包的相同 docker 环境来构建 APM Agent。
该 Agent 目前仅适用于 Linux 操作系统。
- 从 https://github.com/elastic/apm-agent-php/ 下载 Agent 源代码。
- 执行以下命令以构建 Agent 并安装它
cd apm-agent-php
# for linux glibc - libc distributions (Ubuntu, Redhat, etc)
export BUILD_ARCHITECTURE=linux-x86-64
# for linux with musl - libc distributions (Alpine)
export BUILD_ARCHITECTURE=linuxmusl-x86-64
# provide a path to php-config tool
export PHP_CONFIG=php-config
# build extensions
make -f .ci/Makefile build
# run extension tests
PHP_VERSION=`$PHP_CONFIG --version | cut -d'.' -f 1,2` make -f .ci/Makefile run-phpt-tests
# install agent extensions
sudo cp agent/native/_build/${BUILD_ARCHITECTURE}-release/ext/elastic_apm-*.so `$PHP_CONFIG --extension-dir`
# install automatic loader
sudo cp agent/native/_build/${BUILD_ARCHITECTURE}-release/loader/code/elastic_apm_loader.so `$PHP_CONFIG --extension-dir`
2. 启用并配置 APM Agent
在 php.ini
文件中启用并配置您的 Agent
extension=elastic_apm_loader.so
elastic_apm.bootstrap_php_part_file=<repo root>/agent/php/bootstrap_php_part.php
在代理参考中了解更多信息
- Django
- 1. 安装 APM Agent
将 Python 的 APM Agent 作为依赖项安装。
$ pip install elastic-apm
2. 配置代理
Agent 是在您的应用程序进程中运行的库。 APM 服务基于 SERVICE_NAME
以编程方式创建。
# Add the agent to the installed apps
INSTALLED_APPS = (
'elasticapm.contrib.django',
# ...
)
ELASTIC_APM = {
# Set required service name. Allowed characters:
# a-z, A-Z, 0-9, -, _, and space
'SERVICE_NAME': '',
# Use if APM integration requires a token
'SECRET_TOKEN': '',
# Set custom APM integration host and port (default: http://localhost:8200)
'SERVER_URL': '',
}
# To send performance metrics, add our tracing middleware:
MIDDLEWARE = (
'elasticapm.contrib.django.middleware.TracingMiddleware',
#...
)
- Flask
- 1. 安装 APM Agent
将 Python 的 APM Agent 作为依赖项安装。
$ pip install elastic-apm[flask]
2. 配置代理
Agent 是在您的应用程序进程中运行的库。 APM 服务基于 SERVICE_NAME
以编程方式创建。
# initialize using environment variables
from elasticapm.contrib.flask import ElasticAPM
app = Flask(__name__)
apm = ElasticAPM(app)
# or configure to use ELASTIC_APM in your application settings
from elasticapm.contrib.flask import ElasticAPM
app.config['ELASTIC_APM'] = {
# Set required service name. Allowed characters:
# a-z, A-Z, 0-9, -, _, and space
'SERVICE_NAME': '',
# Use if APM integration requires a token
'SECRET_TOKEN': '',
# Set custom APM integration host and port (default: http://localhost:8200)
'SERVER_URL': '',
}
apm = ElasticAPM(app)
在代理参考中了解更多信息
1. 安装 APM Agent
将 Agent 添加到您的 Gemfile。
gem 'elastic-apm'
2. 配置代理
- Ruby on Rails
- 当您的应用程序启动时,APM 会自动启动。通过创建配置文件
config/elastic_apm.yml
配置 Agent
# config/elastic_apm.yml:
# Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space
# Defaults to the name of your Rails app
service_name: 'my-service'
# Use if APM integration requires a token
secret_token: ''
# Set custom APM integration host and port (default: http://localhost:8200)
server_url: 'http://localhost:8200'
- Rack
- 对于 Rack 或兼容的框架(如 Sinatra),请在您的应用程序中包含中间件并启动 Agent。
# config.ru
app = lambda do |env|
[200, {'Content-Type' => 'text/plain'}, ['ok']]
end
# Wraps all requests in transactions and reports exceptions
use ElasticAPM::Middleware
# Start an instance of the Agent
ElasticAPM.start(service_name: 'NothingButRack')
run app
# Gracefully stop the agent when process exits.
# Makes sure any pending transactions are sent.
at_exit { ElasticAPM.stop }
创建配置文件
创建配置文件 config/elastic_apm.yml
# config/elastic_apm.yml:
# Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space
# Defaults to the name of your Rack app's class.
service_name: 'my-service'
# Use if APM integration requires a token
secret_token: ''
# Set custom APM integration host and port (default: http://localhost:8200)
server_url: 'http://localhost:8200'
在代理参考中了解更多信息
1. 启用真实用户监控 (RUM)
RUM 默认禁用。通过将 Enable RUM
设置为 true
来启用它。
2. 设置 Agent
使用 <script>
标签或使用打包器设置 Agent。
同步/阻塞模式
添加一个 <script> 标签来加载包并使用 elasticApm
全局对象来初始化 Agent
<script src="https://<your-cdn-host>.com/path/to/elastic-apm-rum.umd.min-<version>.js" crossorigin></script>
<script>
elasticApm.init({
serviceName: '<instrumented-app>',
serverUrl: '<apm-server-url>',
})
</script>
异步/非阻塞模式
异步加载脚本可确保 Agent 脚本不会阻止页面上的其他资源,但是,它仍然会阻止浏览器 onload
事件。
<script>
;(function(d, s, c) {
var j = d.createElement(s),
t = d.getElementsByTagName(s)[0]
j.src = 'https://<your-cdn-host>.com/path/to/elastic-apm-rum.umd.min-<version>.js'
j.onload = function() {elasticApm.init(c)}
t.parentNode.insertBefore(j, t)
})(document, 'script', {serviceName: '<instrumented-app>', serverUrl: '<apm-server-url>'})
</script>
使用打包器
将真实用户监控 APM Agent 作为依赖项安装到您的应用程序
npm install @elastic/apm-rum --save
配置 Agent
import { init as initApm } from '@elastic/apm-rum'
const apm = initApm({
// Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)
serviceName: '',
// Set custom APM integration host and port (default: http://localhost:8200)
serverUrl: 'http://localhost:8200',
// Set service version (required for sourcemap feature)
serviceVersion: ''
})
在代理参考中了解更多信息
Elastic 与 OpenTelemetry 集成,允许您重用现有的检测,以便轻松地将可观察性数据发送到 Elastic Stack。
有关如何结合使用 Elastic 和 OpenTelemetry 的更多信息,请参阅OpenTelemetry 集成。
一旦您至少有一个 APM Agent 向 APM Server 发送数据,您就可以开始在 Kibana Applications UI 中可视化您的数据。

我们为基于 APT 和 YUM 的发行版提供存储库。请注意,我们提供二进制包,但不提供源代码包。
我们使用 PGP 密钥 D88E42B4, Elasticsearch Signing Key, 指纹为
4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4
来签名我们所有的包。它可从 https://pgp.mit.edu 获得。
要为 APT 添加 apm-server 存储库
下载并安装公共签名密钥
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
在继续之前,您可能需要在 Debian 上安装
apt-transport-https
包sudo apt-get install apt-transport-https
将存储库定义保存到
/etc/apt/sources.list.d/elastic-9.0.0.list
echo "deb https://artifacts.elastic.co/packages/9.0.0-prerelease/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-9.0.0-prerelease.list
警告要添加 Elastic 存储库,请确保使用示例中显示的
echo
方法。不要使用add-apt-repository
,因为它会添加一个deb-src
条目,但我们不提供源代码包。如果您错误地添加了
deb-src
条目,您将看到如下错误Unable to find expected entry 'main/source/Sources' in Release file (Wrong sources.list entry or malformed file)
运行
apt-get update
,存储库即可使用。例如,您可以通过运行以下命令安装 APM Serversudo apt-get update && sudo apt-get install apm-server
要配置 APM Server 在启动时自动启动,请运行
sudo systemctl enable apm-server
要为 YUM 添加 apm-server 存储库
下载并安装公共签名密钥
sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
在您的 /etc/yum.repos.d/ 目录中创建一个带有 .repo 扩展名的文件(例如,elastic.repo)并添加以下行
[elastic-9.0.0] name=Elastic repository for 9.0.0 packages baseurl=https://artifacts.elastic.co/packages/9.0.0/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
您的存储库可以使用了。例如,您可以通过运行以下命令安装 APM Server
sudo yum install apm-server
要配置 APM Server 在启动时自动启动,请运行
sudo systemctl enable apm-server
APM Server 的 Docker 镜像可从 Elastic Docker 注册表中获得。基本镜像为 ubuntu:22.04。
所有已发布的 Docker 镜像和标签的列表可在 www.docker.elastic.co 上获得。
这些镜像可以根据 Elastic 许可免费使用。它们包含开源和免费的商业功能,以及对付费商业功能的访问。开始 30 天试用 以试用所有付费商业功能。有关 Elastic 许可级别的信息,请参阅订阅页面。
获取 APM Server for Docker 就像针对 Elastic Docker 注册表发出 docker pull
命令,然后选择性地验证镜像一样简单。
拉取 Docker 镜像
docker pull docker.elastic.co/apm/apm-server:9.0.0
或者,您可以使用强化的 Wolfi 镜像
docker pull docker.elastic.co/apm/apm-server-wolfi:9.0.0
验证 Docker 镜像
wget https://artifacts.elastic.co/cosign.pub cosign verify --key cosign.pub docker.elastic.co/apm/apm-server:9.0.0
cosign
命令以 JSON 格式打印检查结果和签名有效负载Verification for docker.elastic.co/apm/apm-server:9.0.0 -- The following checks were performed on each of these signatures: - The cosign claims were validated - Existence of the claims in the transparency log was verified offline - The signatures were verified against the specified public key
Docker 镜像提供了几种配置 APM Server 的方法。传统方法是通过卷挂载提供配置文件,但也可以创建一个包含您的配置的自定义镜像。
下载此示例配置文件作为起点
curl -L -O https://raw.githubusercontent.com/elastic/apm-server/master/apm-server.docker.yml
在 Docker 上配置 APM Server 的一种方法是通过卷挂载提供 apm-server.docker.yml
。使用 docker run
,可以像这样指定卷挂载。
docker run -d \
-p 8200:8200 \
--name=apm-server \
--user=apm-server \
--volume="$(pwd)/apm-server.docker.yml:/usr/share/apm-server/apm-server.yml:ro" \
docker.elastic.co/apm/apm-server:9.0.0 \
--strict.perms=false -e \
-E output.elasticsearch.hosts=["elasticsearch:9200"] <1>
- 替换您的 Elasticsearch 主机和端口。
- 如果您使用的是 Elastic Cloud Hosted,请使用前面显示的语法,用 Cloud ID 和 elastic 密码替换
-E output.elasticsearch.hosts
行。
之前下载的 apm-server.docker.yml
应该针对您的环境进行自定义。有关更多详细信息,请参阅配置 APM Server。编辑配置文件并对其进行自定义以匹配您的环境,然后重新部署您的 APM Server 容器。
可以将您的 APM Server 配置嵌入到自定义镜像中。以下是一个实现此目的的 Dockerfile 示例
FROM docker.elastic.co/apm/apm-server:9.0.0
COPY --chmod=0644 --chown=1000:1000 apm-server.yml /usr/share/apm-server/apm-server.yml