diff --git a/Makefile b/Makefile index 6dd4810..5c7f0a8 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,23 @@ kind-clean: chart-install: helm upgrade --install otel-shopping-cart ./charts/otel-shopping-cart +.PHONY: app-install +app-install: + helm upgrade \ + --install \ + --set cart.image.repository=ghcr.io/trstringer/otel-shopping-cart-cart \ + --set user.image.repository=ghcr.io/trstringer/otel-shopping-cart-users \ + --set price.image.repository=ghcr.io/trstringer/otel-shopping-cart-price \ + --set db.dataseed.image.repository=ghcr.io/trstringer/otel-shopping-cart-dataseed \ + --set collector.image.repository=ghcr.io/trstringer/otel-shopping-cart-collector \ + --set trafficgen.image.repository=ghcr.io/trstringer/otel-shopping-cart-trafficgen \ + --set interrupter.image.repository=ghcr.io/trstringer/otel-shopping-cart-interrupter \ + otel-shopping-cart \ + ./charts/otel-shopping-cart + +.PHONY: app-install-with-tools +app-install-with-tools: jaeger-deploy app-install + .PHONY: collector-custom-build collector-custom-build: ocb --config ./collector/manifest.yaml diff --git a/README.md b/README.md index cd7d39c..eb936eb 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,52 @@ # OpenTelemetry shopping cart application -Sample/demo application to highlight distributed tracing and other aspects with [OpenTelemetry](https://opentelemetry.io/). Some features about this sample application are that it highlights tracing and propagation through multiple services in different languages (Go and Python). It also illustrates manual instrumentation extensively as well as automatic instrumentation with Flask and PostgreSQL. +Sample application to highlight distributed tracing and other aspects with [OpenTelemetry](https://opentelemetry.io/). -## Application design +## Why? -![Application design](./images/otel-shopping-cart-design.png) +OpenTelemetry is great, but generating signals (traces, metrics, and logs) isn't trivial if you're trying to learn, build, or experiment. This application is a good source of telemetry. Install it, fork it, add to it, do what you want with it! -There are three services in this application: +## Usage -* **Cart** - Service handling user requests for shopping cart data (written in Go) -* **User** - Handles user verification and lookup requests from the cart service (written in Go) -* **Price** - Serves update pricing information for products (written in Python) +There are a few ways to "use" the application... -The backend persistent application data storage is with **PostgreSQL**. +If you want to run _everything_ in a local [kind](https://kind.sigs.k8s.io/) cluster: -Instrumentation is entirely with OpenTelemetry's APIs and SDKs. Telemetry collection is achieved through the [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector) sending trace data to Jaeger. - -## Running local +```bash +make deploy +``` Local dependencies: -* [kind](https://kind.sigs.k8s.io/) with a [local registry](https://kind.sigs.k8s.io/docs/user/local-registry/) -* [ocb](https://opentelemetry.io/docs/collector/custom-collector/), the OpenTelemetry Collector Builder +* [kind](https://kind.sigs.k8s.io/) +* [ocb](https://opentelemetry.io/docs/collector/custom-collector/) * [helm](https://helm.sh/docs/intro/install/) +If you already have a Kubernetes cluster and you want the application and observability tooling: + +```bash +make app-install-with-tools ``` -$ make deploy + +Local dependency: [helm](https://helm.sh/docs/intro/install/) + +If you want _just_ the application: + +```bash +make app-install ``` -Once the deployment succeeds (verify pod statuses with `kubectl get po`), you can curl the cart service: +Local dependency: [helm](https://helm.sh/docs/intro/install/) + +## Viewing telemetry -1. `kubectl port-forward svc/cart 8000:80` -1. `curl localhost:8000/cart/tlasagna` +Once everything is installed, you should be able to view the traces through Jaeger. If you installed Jaeger either with `make deploy` or `make app-install-with-tools` you can port-forward: -Then navigate to the Jaeger instance and view the trace data: +```bash +make jaeger-port-forward +``` -1. `kubectl port-forward svc/jaeger-query 16686` -1. Open your browser and navigate to `localhost:16686` +And navigate your browser to `localhost:16686` to view traces: ![Jaeger trace data](./images/otel-shopping-cart-jaeger-trace.png) @@ -47,3 +57,17 @@ To cleanup the local instance, run: ``` $ make clean ``` + +## Application design + +![Application design](./images/otel-shopping-cart-design.png) + +There are three services in this application: + +* **Cart** - Service handling user requests for shopping cart data (written in Go) +* **User** - Handles user verification and lookup requests from the cart service (written in Go) +* **Price** - Serves update pricing information for products (written in Python) + +The backend persistent application data storage is with **PostgreSQL**. + +Instrumentation is entirely with OpenTelemetry's APIs and SDKs. Telemetry collection is achieved through the [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector) sending trace data to Jaeger. diff --git a/charts/otel-collector/values.yaml b/charts/otel-collector/values.yaml deleted file mode 100644 index 980b762..0000000 --- a/charts/otel-collector/values.yaml +++ /dev/null @@ -1,19 +0,0 @@ -mode: daemonset - -config: - processors: - batch: - send_batch_size: 8192 - exporters: - logging: - loglevel: debug - jaeger: - endpoint: jaeger-collector:14250 - tls: - insecure: true - service: - pipelines: - traces: - receivers: [otlp] - processors: [batch] - exporters: [logging, jaeger]