Skip to content

Commit

Permalink
Refactor make targets (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
trstringer authored Feb 25, 2024
1 parent 1e0a1a1 commit 61e7909
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 39 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 44 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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.
19 changes: 0 additions & 19 deletions charts/otel-collector/values.yaml

This file was deleted.

0 comments on commit 61e7909

Please sign in to comment.