Code Monkey home page Code Monkey logo

tns's Introduction

TNS Observability Demo

A simple three-tier demo application, fully instrumented with Prometheus, OpenTracing and Go-kit logging.

The "TNS" name comes from "The New Stack", where the original demo code was used for an article.

Instructions

  1. Build:
$ make
  1. Run:
$ kubectl apply -f ./production/k8s-yamls
  1. Monitoring with Prometheus

Requires tanka and a recent version of jsonnet-bundler:

$ GO111MODULE=on go get github.com/grafana/tanka/cmd/[email protected]
$ go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
$ mkdir tanka; cd tanka
$ tk init
$ tk env set environments/default --server=https://kubernetes.docker.internal:6443 # if you're using docker desktop.
$ jb install github.com/grafana/jsonnet-libs/prometheus-ksonnet
$ curl https://raw.githubusercontent.com/ksonnet/ksonnet-lib/master/ksonnet.beta.3/k8s.libsonnet > vendor/k8s.libsonnet
$ curl https://raw.githubusercontent.com/ksonnet/ksonnet-lib/master/ksonnet.beta.3/k.libsonnet > vendor/k.libsonnet

Update environments/default/main.jsonnet to be:

local prometheus = import "prometheus-ksonnet/prometheus-ksonnet.libsonnet";

prometheus {
  local service = $.core.v1.service,
  _config+:: {
    namespace: "default",
    cluster_name: "docker",
  },

  _images+:: {
    grafana: "grafana/grafana-dev:explore-trace-ui-demo-c8434d13350e0f43c3937ff37ce8932310ac7fd9-ubuntu",
  },

  prometheus_service+: $.prometheus {
    name: "prometheus",

    prometheus_container+::
        $.util.resourcesRequests('250m', '500Mi'),
  },

  // Expose the nginx admin frontend on port 30040 of the node.
  nginx_service+:
    service.mixin.spec.withType("NodePort") +
    service.mixin.spec.withPorts({
        nodePort: 30040,
        port: 8080,
        targetPort: 80,
    }),
}

Apply:

$ tk apply environments/default

Then go to http://localhost:30040/ to see the monitoring stack.

3b. Add dashboards for demo app

$ jb install https://github.com/grafana/tns/production/tns-mixin/

Update environments/default/main.jsonnet to be:

local prometheus = import "prometheus-ksonnet/prometheus-ksonnet.libsonnet";
local mixin = import "tns-mixin/mixin.libsonnet";

prometheus + mixin {
...
$ tk apply environments/default
  1. Log Aggregation with Grafana Loki
$ helm init
$ helm repo add loki https://grafana.github.io/loki/charts
$ helm repo update
$ helm upgrade --install loki loki/loki-stack

Add a Loki datasource to Grafana, pointing at http://loki.default.svc.cluster.local:3100.

  1. Install Jaeger
$ kubectl apply -f ./production/jaeger

(The app is already configured to send traces to jaeger.)

  1. Setup The Trace Demo

Override the Grafana Image by adding the following to your main.jsonnet and run tk apply.

_images+:: {
  grafana: "grafana/grafana-dev:explore-trace-ui-demo-b56f2a8ae23d399f6e170f439c058f4bdb08f0da-ubuntu",
},

Add a Jaeger datasource:

Navigate to the Loki datasource and add a derived field:

tns's People

Contributors

davkal avatar gouthamve avatar joe-elliott avatar peterbourgon avatar tomwilkie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.