Deploying OTel Collector on Northflank
OTel Collector is available as an official Docker image (opens in a new tab) on Docker Hub. We can use it as a base image and layer in our configuration before deploying it on Railway. You find the resources for the Deployment here (opens in a new tab).
We will use Northflank's ability to deploy from a repository using a Dockerfile (opens in a new tab) to set up our Prometheus instance.
Create a file named
otel-collector-config.yaml to specify a receiver endpoint for sending metrics from the instrumented application.
As the OTel Collector acts as a proxy, we can define an exporter to send metrics. In this example, metrics are pushed to Prometheus's remote write receiver (opens in a new tab). Note that while Prometheus advises against this method for efficient sample ingestion, it is chosen here because Autometrics relies on Prometheus for superior querying and visualization capabilities.
enabled: true # Convert resource attributes to
You can find an example otel-config.yaml here (opens in a new tab).
The below Dockerfile (opens in a new tab) uses the base Otel Collector image and loads our configuration
ADD otel-collector-config.yaml /etc/otelcol/config.yaml
Create a Northflank service from our newly created GitHub repo, it should pick up the configuration from the Dockerfile.
In order to make Prometheus accessible to other services in your Northflank network or externally configure the PORT & DNS settings under the service network section in the Northflank UI.
Utilize the 'push' capabilities in your chosen Autometrics language library, detailed in each language's quickstart section. When initializing the OTLP exporter, specify the endpoint for your deployed OTel Collector. Note that the OTel Collector expects metrics at /v1/metrics.
If you have deployed the OTel collector with the port set to 4318 your internal Northflank endpoint should look something like this: