Skip to content

Commit

Permalink
Merge branch 'main' into Load-generator-Web-request-spamming
Browse files Browse the repository at this point in the history
  • Loading branch information
julianocosta89 authored Apr 4, 2024
2 parents dfc5a55 + 06023dd commit a358327
Show file tree
Hide file tree
Showing 19 changed files with 140 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ FRONTEND_HOST=frontend
ENVOY_PORT=8080
FRONTEND_PROXY_ADDR=frontend-proxy:${ENVOY_PORT}

# Image Provider
IMAGE_PROVIDER_HOST=imageprovider
IMAGE_PROVIDER_PORT=8081

# Load Generator
LOCUST_WEB_PORT=8089
LOCUST_USERS=10
Expand Down
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ the release.

## Unreleased

* [Imageprovider] Create Nginx service to host images, add instrumentation to it
([#1462](https://github.com/open-telemetry/opentelemetry-demo/pull/1462))
* [loadgenerator] added loadgeneratorFloodHomepage flagd
([#1486](https://github.com/open-telemetry/opentelemetry-demo/pull/1486))

## 1.9.0

* [featureflag] deprecate in favor of flagd
Expand Down Expand Up @@ -53,8 +58,6 @@ the release.
([#1470](https://github.com/open-telemetry/opentelemetry-demo/pull/1470))
* [frontend] disable instrumentation-fs library
([#1473](https://github.com/open-telemetry/opentelemetry-demo/pull/1473))
* [loadgenerator] added loadgeneratorFloodHomepage flagd
([#1486](https://github.com/open-telemetry/opentelemetry-demo/pull/1486))

## 1.8.0

Expand Down
31 changes: 31 additions & 0 deletions docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ services:
condition: service_started
otelcol:
condition: service_started
imageprovider:
condition: service_started
logging: *logging

# Frontend Proxy (Envoy)
Expand Down Expand Up @@ -256,6 +258,8 @@ services:
- GRAFANA_SERVICE_HOST
- JAEGER_SERVICE_PORT
- JAEGER_SERVICE_HOST
- IMAGE_PROVIDER_HOST
- IMAGE_PROVIDER_PORT
- OTEL_COLLECTOR_HOST
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_COLLECTOR_PORT_HTTP
Expand All @@ -271,6 +275,33 @@ services:
grafana:
condition: service_started

# Imageprovider
imageprovider:
image: ${IMAGE_NAME}:${DEMO_VERSION}-imageprovider
container_name: imageprovider
build:
context: ./
dockerfile: ./src/imageprovider/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-imageprovider
deploy:
resources:
limits:
memory: 120M
restart: unless-stopped
ports:
- "${IMAGE_PROVIDER_PORT}"
environment:
- IMAGE_PROVIDER_PORT
- OTEL_COLLECTOR_HOST
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_SERVICE_NAME=imageprovider
- OTEL_RESOURCE_ATTRIBUTES
depends_on:
otelcol:
condition: service_started
logging: *logging

# Load Generator
loadgenerator:
image: ${IMAGE_NAME}:${DEMO_VERSION}-loadgenerator
Expand Down
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ services:
condition: service_started
otelcol:
condition: service_started
imageprovider:
condition: service_started
logging: *logging

# Frontend Proxy (Envoy)
Expand Down Expand Up @@ -336,6 +338,8 @@ services:
- JAEGER_SERVICE_PORT
- JAEGER_SERVICE_HOST
- OTEL_COLLECTOR_HOST
- IMAGE_PROVIDER_HOST
- IMAGE_PROVIDER_PORT
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_COLLECTOR_PORT_HTTP
- OTEL_RESOURCE_ATTRIBUTES
Expand All @@ -350,6 +354,33 @@ services:
grafana:
condition: service_started

# Imageprovider
imageprovider:
image: ${IMAGE_NAME}:${DEMO_VERSION}-imageprovider
container_name: imageprovider
build:
context: ./
dockerfile: ./src/imageprovider/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-imageprovider
deploy:
resources:
limits:
memory: 120M
restart: unless-stopped
ports:
- "${IMAGE_PROVIDER_PORT}"
environment:
- IMAGE_PROVIDER_PORT
- OTEL_COLLECTOR_HOST
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_SERVICE_NAME=imageprovider
- OTEL_RESOURCE_ATTRIBUTES
depends_on:
otelcol:
condition: service_started
logging: *logging

# Load Generator
loadgenerator:
image: ${IMAGE_NAME}:${DEMO_VERSION}-loadgenerator
Expand Down
14 changes: 14 additions & 0 deletions src/frontendproxy/envoy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ static_resources:
route: { cluster: jaeger }
- match: { prefix: "/grafana" }
route: { cluster: grafana }
- match: { prefix: "/images/" }
route: { cluster: imageprovider, prefix_rewrite: "/" }
- match: { prefix: "/" }
route: { cluster: frontend }
http_filters:
Expand Down Expand Up @@ -94,6 +96,18 @@ static_resources:
socket_address:
address: ${FRONTEND_HOST}
port_value: ${FRONTEND_PORT}
- name: imageprovider
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: imageprovider
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${IMAGE_PROVIDER_HOST}
port_value: ${IMAGE_PROVIDER_PORT}
- name: loadgen
type: STRICT_DNS
lb_policy: ROUND_ROBIN
Expand Down
23 changes: 23 additions & 0 deletions src/imageprovider/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

FROM nginx:1.25.3

RUN apt-get update ; apt-get install lsb-release --no-install-recommends --no-install-suggests -y

# This file is needed for nginx-module-otel to be found.
RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list

RUN apt-get update ; apt-get install nginx-module-otel --no-install-recommends --no-install-suggests -y

RUN mkdir /static
COPY src/imageprovider/static /static

EXPOSE ${IMAGE_PROVIDER_PORT}

STOPSIGNAL SIGQUIT

COPY src/imageprovider/nginx.conf.template /nginx.conf.template

# Start nginx
CMD ["/bin/sh" , "-c" , "envsubst '$OTEL_COLLECTOR_HOST $IMAGE_PROVIDER_PORT $OTEL_COLLECTOR_PORT_GRPC $OTEL_SERVICE_NAME' < /nginx.conf.template > /etc/nginx/nginx.conf && cat /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"]
32 changes: 32 additions & 0 deletions src/imageprovider/nginx.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
load_module modules/ngx_otel_module.so;

events {
worker_connections 1024;
}

http {
otel_exporter {
endpoint ${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC};
}
otel_trace on;
otel_trace_context propagate;
otel_service_name ${OTEL_SERVICE_NAME};
otel_span_name imageprovider;


include mime.types;
sendfile on;
server {
listen ${IMAGE_PROVIDER_PORT};
listen [::]:${IMAGE_PROVIDER_PORT};

resolver 127.0.0.11;
autoindex off;

server_name _;
server_tokens off;

root /static;
gzip_static on;
}
}
File renamed without changes

0 comments on commit a358327

Please sign in to comment.