marblexyz/datadog-agent: The Smallest Possible Sidecar That Makes Railway Observable

A three-file template that turns the official Datadog Agent into a deployable observability layer, and shows why one networking flag matters more than a lot of code.

5 min read • View on GitHub • More from marblexyz

A compact sidecar container latched onto an application container, with telemetry flowing through the agent and onward to an external backend. The image explains how this repository turns observability into a deployable companion rather than a separate ops project.
The repo wraps a standard agent image in a platform-specific sidecar shape, so telemetry becomes part of deployment instead of a separate integration task.
Key Takeaways

The hidden trick: making Datadog visible inside Railway

The surprise here is not that Datadog can collect telemetry. It is that this repo turns the agent into something a Railway app can actually reach. That one shift, from local-only daemon to shared observability endpoint, is the whole point.

In practice, this is a sidecar template. The application runs beside the agent, the agent forwards data to Datadog, and a single networking choice makes the setup work inside a container platform instead of only on a host.

The core idea is a boundary change, not an agent rewrite. Once the agent accepts non-local traffic, it becomes a shared observability node for the whole deployment.

Why a three-file repository is enough

The repo is tiny because it leans on the official Datadog Agent image. The heavy lifting already lives upstream. This wrapper only has to choose a base image, set the right environment variables, and document the deploy path.

What the Dockerfile actually changes

The Dockerfile is the whole implementation. It starts from datadog/agent:7, enables APM, and then changes the traffic model so the agent listens beyond localhost.

FROM datadog/agent:7

ENV DD_APM_ENABLED=true
ENV NON_LOCAL_TRAFFIC=true
ENV DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true

ARG DD_API_KEY

Each line is a decision. DD_APM_ENABLED=true turns on tracing. NON_LOCAL_TRAFFIC=true and DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true widen the listener so other containers can talk to the agent. DD_API_KEY is the injection point for credentials, which keeps secrets out of the image itself.

Line itemWhat it changesWhy it matters
Base imageUses the official Datadog Agent v7The repo inherits a mature runtime instead of rebuilding it
APM flagEnables trace collectionApplication performance data is available immediately
Non-local trafficOpens the agent beyond localhostSibling containers can send telemetry to the same endpoint
API key argDefines a credential inputThe agent can forward data without hardcoding secrets

The tradeoff: local safety versus platform convenience

This is the only real tension in the repo. By letting non-local traffic in, the agent becomes more useful inside a multi-container platform. It also becomes a little less narrow from a network perspective.

A close-up of a gate or valve inside a container network, with one side sealed to localhost traffic and the other side opened to sibling containers. The image explains the security and convenience tradeoff behind the NON_LOCAL_TRAFFIC setting.
The flag is small, but the effect is large. It changes who can reach the agent, which is why it sits at the center of the article.
DimensionTraditional host setupRailway sidecar template
Setup effortManual installation and host configurationA deployable template with the agent pre-wired
Network modelAgent listens locally on the machineAgent accepts container-to-container telemetry
Operational ownershipYou manage the host and agent lifecycleThe platform and template absorb most of the setup
Security postureNarrower by defaultSlightly wider reach inside the deployment
PortabilityTied to a specific environmentReusable as a template on the target platform
Time to first telemetryLongerMuch shorter

Now with @๐š–๐šŠ๐šœ๐š๐š›๐šŠ/๐šŒ๐š˜๐š›๐šŽ@๐Ÿท.๐Ÿป๐Ÿป.๐Ÿถ you can use ๐™ณ๐šŠ๐š๐šŠ๐š๐š˜๐š๐™ฑ๐š›๐š’๐š๐š๐šŽ to send your agent traces into Datadog: https://t.co/w0x7ZQUQYh

Mastra, mastra, 13,562 followers ยท @mastra on X

Why this looks like infrastructure, but reads like product design

This repo behaves like a golden path. It removes decisions, narrows the surface area, and turns a fairly fiddly observability setup into something a developer can launch without reading a playbook.

That is product design work, even when it ships as Dockerfile syntax. The value is not novelty. The value is a repeatable default that saves time and reduces mistakes.

What this repo says about modern observability

The bigger pattern is clear. Observability is increasingly packaged as a deployable primitive, not a manual integration project. The agent, the platform, and the template each do a small part of the job.

That is why this repository can stay so small. Its job is not to invent a new agent. Its job is to choose the right boundary between usability and safety, then make that boundary easy to ship.