Skip to content

Commit

Permalink
Add Opentelemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe GUEMKAM committed Aug 5, 2024
1 parent 158c9ff commit f281397
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml → .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ jobs:
tags: imzerofiltre/zerofiltretech-provisioner:${{ github.run_number }}_${{ env.DOCKER_TAG_SUFFIX }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

build-args: PROFILE=${{ env.env_name }}

- name: Set up kubectl
uses: tale/kubectl-action@v1
with:
base64-kube-config: ${{ secrets.KUBE_CONFIG }}

- name: Set up k8s manifest
run: |
envsubst < k8s-env.yaml > k8s.yml
envsubst < microservice.yaml > k8s.yml
cat k8s.yml
- name: Deploy to k8s
Expand Down
20 changes: 18 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@ FROM python:3.8

WORKDIR /app

ARG PROFILE=dev

COPY requirements.txt /app/
COPY . /app/

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 5000
# Install OpenTelemetry dependencies
RUN pip install opentelemetry-distro opentelemetry-exporter-otlp
RUN opentelemetry-bootstrap -a install

# Make sure entrypoint.sh is executable
RUN chmod 755 entrypoint.sh

ENTRYPOINT ["./entrypoint.sh"]
EXPOSE 5000

# Set environment variables for OpenTelemetry
ENV OTEL_SERVICE_NAME=sandbox-provisioner-${PROFILE}
ENV OTEL_LOGS_EXPORTER=otlp,console
ENV OTEL_TRACES_EXPORTER=otlp
ENV OTEL_METRICS_EXPORTER=otlp
ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol-opentelemetry-collector.monitoring.svc.cluster.local:4317

# Set entrypoint
ENTRYPOINT ["./entrypoint.sh"]
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

echo "The app is starting ..."

python run.py
opentelemetry-instrument python run.py
File renamed without changes.

0 comments on commit f281397

Please sign in to comment.