MCPcopy Index your code
hub / github.com/elastic/apm-server

github.com/elastic/apm-server @v9.4.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v9.4.3 ↗ · + Follow
2,042 symbols 9,124 edges 341 files 663 documented · 32%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ci Smoke Tests Package status

APM Server

The APM Server receives data from Elastic APM agents and transforms it into Elasticsearch documents. Read more about Elastic APM at elastic.co/apm.

For questions and feature requests, visit the discussion forum.

Getting Started

To get started with APM, see our Quick start guide.

APM Server Development

Requirements

Install

  • Fork the repo with the GitHub interface and clone it:
git clone git@github.com:[USER]/apm-server.git

Note that it should be cloned from the fork (replace [USER] with your GitHub user), not from origin.

  • Add the upstream remote:
git remote add elastic git@github.com:elastic/apm-server.git

Build

To build the binary for APM Server run the command below. This will generate a binary in the same directory with the name apm-server.

make

If you make code changes, you may also need to update the project by running the additional command below:

make update

Run

To run APM Server with debugging output enabled, run:

./apm-server -c apm-server.yml -e -d "*"

APM Server expects index templates, ILM policies, and ingest pipelines to be set up externally. This should be done by installing the APM integration. When running APM Server directly, it is only necessary to install the integration and not to run an Elastic Agent.

Tilt

You can also run APM Server in a containerized environment using Tilt.

tilt up

See dev docs testing for additional information.

Testing

For Testing check out the testing guide

Cleanup

To clean up the build directory and generated artifacts, run:

make clean

Contributing

See contributing for details about reporting bugs, requesting features, or contributing to APM Server.

Releases

See releases for an APM Server release checklist.

Updating dependencies

APM Server uses Go Modules for dependency management, without any vendoring.

In general, you should use standard go get commands to add and update modules. The one exception to this is the dependency on libbeat, for which there exists a special Make target: make update-beats, described below.

Updating libbeat

By running make update-beats the github.com/elastic/beats/vN module will be updated to the most recent commit from the main branch, and a minimal set of files will be copied into the apm-server tree.

You can specify an alternative branch or commit by specifying the BEATS_VERSION variable, such as:

make update-beats BEATS_VERSION=7.x
make update-beats BEATS_VERSION=f240148065af94d55c5149e444482b9635801f27

Packaging

To build all apm-server packages from source, run:

make package

This will fetch and create all images required for the build process. The whole process can take several minutes. When complete, packages can be found in build/distributions/.

Building docker packages

To customize image configuration, see the docs.

To build docker images from source, run:

make package-docker

When complete, Docker images can be found at build/distributions/*.docker.tar.gz, and the local Docker image IDs are written at build/docker/*.txt.

Building pre-release images can be done by running make package-docker-snapshot instead.

Documentation

Documentation for the APM Server can be found in the Observability guide's APM section. Most documentation files live in the elastic/observability-docs repo's docs/en/observability/apm/ directory.

However, the following content lives in this repo:

Extension points exported contracts — how you extend this code

Fetcher (Interface)
Fetcher defines a common interface to retrieving agent config. [12 implementers]
internal/agentcfg/fetch.go
Runner (Interface)
Runner is an interface returned by NewRunnerFunc. [10 implementers]
internal/beatcmd/reloader.go
Fetcher (Interface)
Fetcher is an interface for fetching a source map with a given service name, service version, and bundle filepath. [12 …
internal/sourcemap/fetcher.go
RW (Interface)
RW is a read writer interface that has methods to read and write trace event and sampling decisions. [6 implementers]
x-pack/apm-server/sampling/eventstorage/rw.go
Authorizer (Interface)
Authorizer provides an interface for authorizing an action and resource. [4 implementers]
internal/beater/auth/authenticator.go
EventMetadataFilter (Interface)
EventMetadata holds event metadata. [1 implementers]
systemtest/apmservertest/filter.go
BenchmarkFunc (FuncType)
BenchmarkFunc is the benchmark function type accepted by Run.
systemtest/benchtest/main.go
Transformer (Interface)
Transformer is an interface implemented by types that can be transformed into beat.Events.
internal/publish/pub.go

Core symbols most depended-on inside this repo

Run
called by 183
internal/beatcmd/reloader.go
Set
called by 159
x-pack/apm-server/sampling/eventstorage/storage.go
Get
called by 115
x-pack/apm-server/sampling/eventstorage/storage.go
Close
called by 107
systemtest/apmservertest/server.go
Error
called by 67
internal/beater/errors.go
Len
called by 64
x-pack/apm-server/sampling/reservoir.go
String
called by 59
systemtest/cmd/runapm/main.go
Close
called by 59
internal/beater/beatertest/server.go

Shape

Function 1,000
Method 595
Struct 360
TypeAlias 33
FuncType 31
Interface 23

Languages

Go100%

Modules by API surface

integrationservertest/steps.go43 symbols
systemtest/apmservertest/config.go37 symbols
x-pack/apm-server/sampling/processor_test.go36 symbols
x-pack/apm-server/sampling/eventstorage/storage_manager.go30 symbols
integrationservertest/internal/kibana/client.go29 symbols
x-pack/apm-server/sampling/eventstorage/rw.go28 symbols
x-pack/apm-server/sampling/pubsub/pubsubtest/client.go25 symbols
systemtest/otlp_test.go25 symbols
systemtest/fleettest/client.go25 symbols
integrationservertest/internal/ech/version.go25 symbols
internal/beater/api/config/agent/handler_test.go24 symbols
internal/beatcmd/beat_test.go24 symbols

For agents

$ claude mcp add apm-server \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact