OpenTelemetry With New Relic
This guide provides a step-by-step procedure to integrate New Relic with Tyk Gateway via the OpenTelemetry Collector. At the end of this guide, you will be able to visualize traces and metrics from your Tyk Gateway on the New Relic console.
- Docker installed on your machine
- New Relic Account
- New Relic API Key
- Gateway v5.2.0 or higher
- OTel Collector docker image
Step 1: Obtain New Relic API Key
Navigate to your New Relic Console.
Profile → API keys.
Copy the key labeled as
Step 2: Configuration Files
OTel Collector Configuration YAML
- Create a file named
otel-collector-config.ymlunder the configs directory.
- Copy the following template into that file:
receivers: otlp: protocols: http: endpoint: 0.0.0.0:4318 grpc: endpoint: 0.0.0.0:4317 processors: batch: exporters: otlphttp: endpoint: "<YOUR-ENVIRONMENT-STRING>" headers: api-Key: "<YOUR-NEW-RELIC-API-KEY>" extensions: health_check: pprof: endpoint: :1888 zpages: endpoint: :55679 service: extensions: [pprof, zpages, health_check] pipelines: traces: receivers: [otlp] processors: [batch] exporters: [otlphttp]
<YOUR-ENVIRONMENT-STRING>with your specific New Relic endpoint (
https://otlp.nr-data.netfor US or
<YOUR-NEW-RELIC-API-KEY>with the API key obtained in Step 1.
Docker Compose configuration
Create a file named docker-compose.yml at the root level of your project directory.
Paste the following code into that file:
version: "3.9" services: otel-collector: image: otel/opentelemetry-collector:latest volumes: - ./otel-collector-config.yml:/etc/otel-collector.yml command: ["--config=/etc/otel-collector.yml"] networks: - tyk ports: - "1888:1888" # pprof extension - "13133:13133" # health_check extension - "4317:4317" # OTLP gRPC receiver - "4318:4318" # OTLP http receiver - "55670:55679" # zpages extension networks: tyk:
Replace the variable fields with the relevant data.
Step 3: Testing and Verifying Traces
docker-compose up -dto start all services.
Initialize your Tyk environment.
Create a simple
httpbinAPI using Tyk Dashboard. You can follow the Tyk Dashboard documentation for more information.
Send requests to the API using cURL or Postman.
Open New Relic Console.
APM & Services → Services - OpenTelemetry → tyk-gateway.
- Wait for about 5 minutes for the data to populate.
Traces and graphs should now be visible on your New Relic console.
If traces are not showing, try refreshing the New Relic dashboard.
- If the traces aren’t appearing, double-check your API key and endpoints.
- Ensure that your Tyk Gateway and New Relic are both running and connected.
You have successfully integrated New Relic with Tyk Gateway via the OpenTelemetry Collector. You can now monitor and trace your APIs directly from the New Relic console.