Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Elastic APM #1195

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Variables. Yes.
DOCKER=docker
DOCKER_BUILDKIT=0

# The main build recipe.
build: clean
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) $(DOCKER) build \
$(DOCKER) build \
--build-arg BRANCH_ENVIRONMENT=$(NODE_ENV) \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VCS_URL=`git config --get remote.origin.url | sed 's#[email protected]:#https://github.com/#'` \
Expand Down
19 changes: 19 additions & 0 deletions docker/99-elastic-apm-custom.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; This file contains the various settings for the Elastic APM PHP agent. For
; further details refers to the following URL:
; https://www.elastic.co/guide/en/apm/agent/php/current/configuration-reference.html
;

[elastic]
elastic_apm.enabled = ${PHP_ELASTIC_APM_ENABLED}
;elastic_apm.api_key = "REPLACE_WITH_API_KEY"
elastic_apm.environment = "${PHP_ELASTIC_APM_ENVIRONMENT}"
elastic_apm.log_level = "INFO"
elastic_apm.log_level_stderr = "INFO"
elastic_apm.secret_token = "${PHP_ELASTIC_APM_TOKEN}"
;elastic_apm.server_timeout = "30s"
elastic_apm.server_url = "${PHP_ELASTIC_APM_SERVER}"
elastic_apm.service_name = "${PHP_ELASTIC_APM_SERVICE}"
elastic_apm.service_version = ${GIT_SHA}
;elastic_apm.transaction_max_spans = 500
;elastic_apm.transaction_sample_rate = 1.0
;elastic_apm.verify_server_cert = true
9 changes: 8 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the code.
FROM public.ecr.aws/unocha/php-k8s:8.3-stable as builder
FROM public.ecr.aws/unocha/php-k8s:8.3-stable AS builder

ARG BRANCH_ENVIRONMENT
ENV NODE_ENV=$BRANCH_ENVIRONMENT
Expand Down Expand Up @@ -60,3 +60,10 @@ COPY --from=builder /srv/www/scripts /srv/www/scripts
COPY --from=builder /srv/www/docker/etc/nginx/ratelimit.conf.template /etc/nginx/ratelimit.conf.template
COPY --from=builder /srv/www/docker/etc/nginx/custom /etc/nginx/custom/
COPY --from=builder /srv/www/docker/etc/nginx/sites-enabled/02_mapbox_proxy_cache.conf /etc/nginx/sites-enabled/02_mapbox_proxy_cache.conf
COPY --from=builder /srv/www/docker/99-elastic-apm-custom.ini /tmp/99-elastic-apm-custom.ini

RUN APM_ARCH=$(uname -m) && \
curl -L -o /tmp/apm-agent-php_1.14.1_${APM_ARCH}.apk https://github.com/elastic/apm-agent-php/releases/download/v1.14.1/apm-agent-php_1.14.1_${APM_ARCH}.apk && \
apk add --allow-untrusted /tmp/apm-agent-php_1.14.1_${APM_ARCH}.apk && \
rm -f /tmp/apm-agent-php_1.14.1_${APM_ARCH}.apk && \
mv -f /tmp/99-elastic-apm-custom.ini /etc/php83/conf.d/99-elastic-apm-custom.ini
Loading