Skip to content

Commit

Permalink
Merge pull request #1379 from 3scale/opentelemetry-instrumentation
Browse files Browse the repository at this point in the history
THREESCALE-7735 THREESCALE-8865 opentelemetry instrumentation
  • Loading branch information
eguzki authored Feb 23, 2023
2 parents c3e529d + 189c6bd commit 50827a0
Show file tree
Hide file tree
Showing 21 changed files with 376 additions and 56 deletions.
10 changes: 6 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ commands:
install-docker-compose:
steps:
- run: |
pip install "docker-compose==${DOCKER_COMPOSE_VERSION}"
curl -sLO https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64
chmod +x docker-compose-linux-x86_64
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
docker-compose version
setup-docker:
Expand All @@ -48,7 +50,7 @@ commands:

setup-build-env:
steps:
- run: apk update && apk add wget make bash curl py-pip git openssh-client
- run: apk update && apk add wget make bash curl git openssh-client
- install-docker-compose
- setup-docker
- attach-workspace
Expand Down Expand Up @@ -107,12 +109,12 @@ executors:
- image: docker:stable
environment:
COMPOSE_TLS_VERSION: "TLSv1_2"
DOCKER_COMPOSE_VERSION: "1.16.1"
DOCKER_COMPOSE_VERSION: "v2.14.0"

openresty:
working_directory: /opt/app-root/apicast
docker:
- image: quay.io/3scale/apicast-ci:openresty-1.19.3-pr1381
- image: quay.io/3scale/apicast-ci:openresty-1.19.3-pr1379
- image: redis:3.2.8-alpine
environment:
TEST_NGINX_BINARY: openresty
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Fixed: OIDC jwt key verification [PR #1389](https://github.com/3scale/APIcast/pull/1389) [THREESCALE-9009](https://issues.redhat.com/browse/THREESCALE-9009)
### Added

- Opentelemetry support. Opentracing is now deprecated [PR #1379](https://github.com/3scale/APIcast/pull/1379) [THREESCALE-7735](https://issues.redhat.com/browse/THREESCALE-7735)

## [3.13.0] 2023-02-07

Expand Down
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM registry.access.redhat.com/ubi8:8.5

ARG OPENRESTY_RPM_VERSION="1.19.3"
ARG OPENRESTY_RPM_VERSION="1.19.3-21.el8"
ARG LUAROCKS_VERSION="2.3.0"
ARG JAEGERTRACING_CPP_CLIENT_RPM_VERSION="0.3.1-13.el8"

LABEL summary="The 3scale API gateway (APIcast) is an OpenResty application, which consists of two parts: NGINX configuration and Lua files." \
description="APIcast is not a standalone API gateway therefore it needs connection to the 3scale API management platform. The container includes OpenResty and uses LuaRocks to install dependencies (rocks are installed in the application folder)." \
Expand All @@ -18,13 +20,17 @@ ENV AUTO_UPDATE_INTERVAL=0 \
PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \
PLATFORM="el8"

RUN sed -i s/enabled=./enabled=0/g /etc/yum/pluginconf.d/subscription-manager.conf
RUN PKGS="perl-interpreter-5.26.3 libyaml-devel-0.1.7 m4 openssl-devel git gcc make curl" && \
mkdir -p "$HOME" && \
yum -y --setopt=tsflags=nodocs install $PKGS && \
rpm -V $PKGS && \
yum clean all -y

RUN dnf install -y 'dnf-command(config-manager)'

RUN yum config-manager --add-repo http://packages.dev.3sca.net/dev_packages_3sca_net.repo

RUN PKGS="perl-interpreter-5.26.3 libyaml-devel-0.1.7 m4 openssl-devel git gcc make curl openresty-resty-${OPENRESTY_RPM_VERSION} luarocks-2.3.0 opentracing-cpp-devel-1.3.0 libopentracing-cpp1-1.3.0 jaegertracing-cpp-client openresty-opentracing-${OPENRESTY_RPM_VERSION}" && \
RUN PKGS="openresty-resty-${OPENRESTY_RPM_VERSION} openresty-opentelemetry-${OPENRESTY_RPM_VERSION} openresty-opentracing-${OPENRESTY_RPM_VERSION} openresty-${OPENRESTY_RPM_VERSION} luarocks-${LUAROCKS_VERSION} opentracing-cpp-devel-1.3.0 libopentracing-cpp1-1.3.0 jaegertracing-cpp-client-${JAEGERTRACING_CPP_CLIENT_RPM_VERSION}" && \
mkdir -p "$HOME" && \
yum -y --setopt=tsflags=nodocs install $PKGS && \
rpm -V $PKGS && \
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile.devel
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM registry.access.redhat.com/ubi8:8.5

ARG OPENRESTY_RPM_VERSION="1.19.3"
ARG OPENRESTY_RPM_VERSION="1.19.3-21.el8"
ARG LUAROCKS_VERSION="2.3.0"
ARG JAEGERTRACING_CPP_CLIENT_RPM_VERSION="0.3.1-13.el8"

WORKDIR /tmp

Expand Down Expand Up @@ -29,8 +30,11 @@ RUN yum config-manager --add-repo http://packages.dev.3sca.net/dev_packages_3sca
RUN yum install -y \
openresty-${OPENRESTY_RPM_VERSION} \
openresty-resty-${OPENRESTY_RPM_VERSION} \
openresty-opentelemetry-${OPENRESTY_RPM_VERSION} \
openresty-opentracing-${OPENRESTY_RPM_VERSION} \
jaegertracing-cpp-client
opentracing-cpp-devel-1.3.0 \
libopentracing-cpp1-1.3.0 \
jaegertracing-cpp-client-${JAEGERTRACING_CPP_CLIENT_RPM_VERSION}

RUN ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
&& ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log \
Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NPROC ?= $(firstword $(shell nproc 2>/dev/null) 1)

SEPARATOR="\n=============================================\n"

DEVEL_IMAGE ?= quay.io/3scale/apicast-ci:openresty-1.19.3-pr1381
DEVEL_IMAGE ?= quay.io/3scale/apicast-ci:openresty-1.19.3-pr1379
DEVEL_DOCKERFILE ?= Dockerfile.devel

RUNTIME_IMAGE ?= quay.io/3scale/apicast:latest
Expand Down Expand Up @@ -63,9 +63,9 @@ export COMPOSE_PROJECT_NAME
# The development image is also used in CI (circleCI) as the 'openresty' executor
# When the development image changes, make sure to:
# * build a new development image:
# make dev-build IMAGE_NAME=quay.io/3scale/apicast-ci:openresty-1.19.3-pr1381
# make dev-build IMAGE_NAME=quay.io/3scale/apicast-ci:openresty-1.19.3-pr{NUM}
# * push to quay.io/3scale/apicast-ci with a fixed tag (avoid floating tags)
# docker push quay.io/3scale/apicast-ci:openresty-1.19.3-pr1381
# docker push quay.io/3scale/apicast-ci:openresty-1.19.3-pr{NUM}
# * update .circleci/config.yaml openresty executor with the image URL
.PHONY: dev-build
dev-build: export OPENRESTY_RPM_VERSION?=1.19.3
Expand Down Expand Up @@ -164,6 +164,12 @@ gateway-logs: export IMAGE_NAME = does-not-matter
gateway-logs:
$(DOCKER_COMPOSE) logs gateway

opentelemetry-gateway: ## run gateway instrumented with opentelemetry
$(DOCKER_COMPOSE) run opentelemetry-instrumented-gateway

opentracing-gateway: ## run gateway instrumented with opentracing
$(DOCKER_COMPOSE) run opentracing-instrumented-gateway

test-runtime-image: export IMAGE_NAME ?= $(RUNTIME_IMAGE)
test-runtime-image: clean-containers ## Smoke test the runtime image. Pass any docker image in IMAGE_NAME parameter.
$(DOCKER_COMPOSE) --version
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ oc new-app -f https://raw.githubusercontent.com/3scale/apicast/master/openshift/
- Rate-limit: can apply limits based on a header, [JWT](https://jwt.io/) claims, the IP of the request and many more.
- Modular and extensible: thanks to the APIcast [policies framework](doc/policies.md).
- Monitoring with [Prometheus](https://prometheus.io/).
- [OpenTracing](https://opentracing.io/) integration with [Jaeger](https://www.jaegertracing.io/).
- [NGINX instrumentation](https://github.com/open-telemetry/opentelemetry-cpp-contrib) using [OpenTelemetry](https://opentelemetry.io/). Works with [Jaeger](https://www.jaegertracing.io/).
- Can be deployed in [Openshift](https://www.openshift.com/).
- Integrates with IDPs like [Keycloak](https://www.keycloak.org) to provide authentication based on [OIDC](https://openid.net/connect/).

Expand Down
Loading

0 comments on commit 50827a0

Please sign in to comment.