add Nginx tracing
This commit is contained in:
@@ -24,6 +24,14 @@ To see the application performance results in the Instana dashboard, you will fi
|
||||
## Build from Source
|
||||
To optionally build from source (you will need a newish version of Docker to do this) use Docker Compose. Optionally edit the `.env` file to specify an alternative image registry and version tag; see the official [documentation](https://docs.docker.com/compose/env-file/) for more information.
|
||||
|
||||
To download the tracing module for Nginx, it needs a valid Instana agent key. Set this in the environment before starting the build.
|
||||
|
||||
```shell
|
||||
$ export INSTANA_AGENT_KEY="<your agent key>"
|
||||
```
|
||||
|
||||
Now build all the images.
|
||||
|
||||
```shell
|
||||
$ docker-compose build
|
||||
```
|
||||
|
@@ -33,7 +33,7 @@ services:
|
||||
- robot-shop
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-H", "X-INSTANA-SYNTHETIC: 1", "-f", "http://localhost:8080/health" ]
|
||||
interval: 1s
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
logging:
|
||||
@@ -49,7 +49,7 @@ services:
|
||||
- robot-shop
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-H", "X-INSTANA-SYNTHETIC: 1", "-f", "http://localhost:8080/health" ]
|
||||
interval: 1s
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
logging:
|
||||
@@ -64,7 +64,7 @@ services:
|
||||
- robot-shop
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-H", "X-INSTANA-SYNTHETIC: 1", "-f", "http://localhost:8080/health" ]
|
||||
interval: 1s
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
logging:
|
||||
@@ -89,7 +89,7 @@ services:
|
||||
- robot-shop
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-H", "X-INSTANA-SYNTHETIC: 1", "-f", "http://localhost:8080/health"]
|
||||
interval: 1s
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
logging:
|
||||
@@ -106,7 +106,7 @@ services:
|
||||
- mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-H", "X-INSTANA-SYNTHETIC: 1", "-f", "http://localhost/_health"]
|
||||
interval: 1s
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
logging:
|
||||
@@ -121,7 +121,7 @@ services:
|
||||
- robot-shop
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-H", "X-INSTANA-SYNTHETIC: 1", "-f", "http://localhost:8080/health"]
|
||||
interval: 1s
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
# Uncomment to change payment gateway
|
||||
@@ -142,6 +142,9 @@ services:
|
||||
web:
|
||||
build:
|
||||
context: web
|
||||
args:
|
||||
# agent key to download tracing libs
|
||||
KEY: ${INSTANA_AGENT_KEY}
|
||||
image: ${REPO}/rs-web:${TAG}
|
||||
depends_on:
|
||||
- catalogue
|
||||
@@ -154,7 +157,7 @@ services:
|
||||
- robot-shop
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-H", "X-INSTANA-SYNTHETIC: 1", "-f", "http://localhost:8080/" ]
|
||||
interval: 1s
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
# Uncomment to enable Instana EUM
|
||||
|
@@ -1,4 +1,20 @@
|
||||
FROM nginx:1.19
|
||||
FROM alpine AS build
|
||||
ARG KEY
|
||||
|
||||
WORKDIR /instana
|
||||
|
||||
RUN apk add --update --no-cache curl
|
||||
|
||||
RUN curl \
|
||||
--output instana.zip \
|
||||
--user "_:$KEY" \
|
||||
https://artifact-public.instana.io/artifactory/shared/com/instana/nginx_tracing/1.1.2/linux-amd64-glibc-nginx-1.20.1.zip && \
|
||||
unzip instana.zip && \
|
||||
mv glibc-libinstana_sensor.so libinstana_sensor.so && \
|
||||
mv glibc-nginx-1.20.1-ngx_http_ot_module.so ngx_http_opentracing_module.so
|
||||
|
||||
|
||||
FROM nginx:1.20.1
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
@@ -7,7 +23,11 @@ ENV CATALOGUE_HOST=catalogue \
|
||||
CART_HOST=cart \
|
||||
SHIPPING_HOST=shipping \
|
||||
PAYMENT_HOST=payment \
|
||||
RATINGS_HOST=ratings
|
||||
RATINGS_HOST=ratings \
|
||||
INSTANA_SERVICE_NAME=nginx-web
|
||||
|
||||
# Instana tracing
|
||||
COPY --from=build /instana/*.so /tmp/
|
||||
|
||||
COPY entrypoint.sh /root/
|
||||
ENTRYPOINT ["/root/entrypoint.sh"]
|
||||
|
@@ -1,3 +1,7 @@
|
||||
# Instana tracing
|
||||
opentracing_load_tracer /usr/local/lib/libinstana_sensor.so /etc/instana-config.json;
|
||||
opentracing_propagate_context;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
@@ -29,5 +29,23 @@ chmod 644 $BASE_DIR/eum.html
|
||||
# apply environment variables to default.conf
|
||||
envsubst '${CATALOGUE_HOST} ${USER_HOST} ${CART_HOST} ${SHIPPING_HOST} ${PAYMENT_HOST} ${RATINGS_HOST}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Patching for Instana tracing
|
||||
mv /tmp/ngx_http_opentracing_module.so /usr/lib/nginx/modules
|
||||
mv /tmp/libinstana_sensor.so /usr/local/lib
|
||||
cat - /etc/nginx/nginx.conf << !EOF! > /tmp/nginx.conf
|
||||
# Extra configuration for Instana tracing
|
||||
load_module modules/ngx_http_opentracing_module.so;
|
||||
|
||||
# Pass through these env vars
|
||||
env INSTANA_SERVICE_NAME;
|
||||
env INSTANA_AGENT_HOST;
|
||||
env INSTANA_AGENT_PORT;
|
||||
env INSTANA_MAX_BUFFERED_SPANS;
|
||||
env INSTANA_DEV;
|
||||
!EOF!
|
||||
|
||||
mv /tmp/nginx.conf /etc/nginx/nginx.conf
|
||||
echo "{}" > /etc/instana-config.json
|
||||
|
||||
exec nginx-debug -g "daemon off;"
|
||||
|
||||
|
Reference in New Issue
Block a user