Slide 1

Slide 1 text

0 Observability and OpenTelemetry 2024-10-18 第106回NearMe技術勉強会 Cyan Chen

Slide 2

Slide 2 text

1 What is Observability? We want to know “Why is it slow?” “What is using so much RAM” “When did this problem start?” “Where is the root cause?” “How do I fix this?” Hard for distributed system!

Slide 3

Slide 3 text

2 The Historical Three Browser Tabs of Observability Logs Texts that are directly output from program indicating the working status. Metrics Numbers or normalized string indicating indicating resource usage or program status. Often with soft context. Tracing Correlated metrics with hard context, user transactions. Learning OpenTelemetry Young, T. and Parker, A.

Slide 4

Slide 4 text

3 OpenTelemetry - Unified Protocol We have too many tools and formats. Prometheus, Cloudwatch, DataDog, Jaeger, etc. They historically require different instrumentations and agents install on hardware or software. Migration means code changes. OpenTelemetry provides a vendors or open source providers independent protocol. Learning OpenTelemetry Young, T. and Parker, A.

Slide 5

Slide 5 text

4 OpenTelemetry - Correlated Signals Learning OpenTelemetry Young, T. and Parker, A. Learning OpenTelemetry Young, T. and Parker, A.

Slide 6

Slide 6 text

5 OpenTelemetry - Collector Architecture https://opentelemetry.io/docs/collector/architecture/ Receivers port data to collector. Processors aggregate and filter data. Exporters pipe data to backends

Slide 7

Slide 7 text

6 SDK sends data to collector. OpenTelemetry - Instrumentation Architecture API provides endpoint for generating telemetry data. Library needs to implement API. Applications needs to have SDK and/or API. https://opentelemetry.io/docs/langu ages/js/getting-started/nodejs/

Slide 8

Slide 8 text

7 OpenTelemetry - How does SDK work?

Slide 9

Slide 9 text

8 Hands-on Prerequisite - Install Pulumi: Download & Install Pulumi - Install Minikube: minikube start - Install Docker Desktop: Docker Desktop: The #1 Containerization Tool for Developers - Install Nodejs 20+: Node.js — Download Node.js®

Slide 10

Slide 10 text

9 Setup Steps 1. `git clone https://github.com/yukimotochern/nearme-study-session.git` - You may have pulled it previous study session for Nx. Just `git pull origin main` 2. `npm install` 3. (optional for types) `npx nx run-many -t prisma-generate` 4. `minikube start --cpus=6 --memory=10g`(this stack is heavy…) 5. `cp open-telemetry-intro/pulumi/.env.example open-telemetry-intro/pulumi/.env` 6. Fill in the `DOCKER_PASSWORD` to `open-telemetry-intro/pulumi/env`. I will paste in google meeting chat. 7. (optionally run the app in docker) a. `npm run open-telemetry-intro:npm install` b. `npm run open-telemetry-intro:dev` 8. `npx nx dev open-telemetry-intro-pulumi`

Slide 11

Slide 11 text

10 Testing 1. Open post api `minikube service $(kubectl get svc -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep '^post-svc-' | head -n 1)` 2. Append`?password=password1&[email protected]&title=hi` to the url and refresh. Refresh a few more times. 3. Open Signoz frontend `minikube service signoz-frontend -n signoz`

Slide 12

Slide 12 text

11 Cleanup 1. `minikube delete` if you don’t have other important resources. 2. `rm -r ~/.pulumi` if you want to eliminate local pulumi backend completely. 3. If you ran the app with Docker `npm run open-telemetry-intro:down`

Slide 13

Slide 13 text

12 Thank you