Introduction to Metrics, Logs and Traces session companion code.

Overview

Introduction to Metrics, Logs and Traces in Grafana

This is the companion repository to a series of presentations over the three pillars of observability within Grafana.

It is presented as a self-enclosed Docker sandbox that includes all of the components required to run on a local machine and experiment with the services provided.

Prerequisites

The following demonstration environment requires:

Overview

The demos from this series were based on the application and code in this repository, which includes:

  • Docker Compose manifest for easy setup.
  • Three-service application:
    • A service requesting data from a REST API server.
    • A REST API server that receives requests and utilises a Database for storing/retrieving data for those requests.
    • A Postgres Database for storing/retrieving data from.
  • Tempo instance for storing trace information.
  • Loki instance for storing log information.
  • Prometheus instance for storing metric information.
  • Grafana instance for visualising observability information.
  • Grafana Agent instance for receiving traces and producing metrics and logs based on these traces.
  • A Node Exporter instance to retrieve resource metrics from the local host.

Running the Demonstration Environment

Docker Compose will download the required Docker images, before starting the demonstration environment. Data will be emitted from the microservice application and be stored in Loki, Tempo and Prometheus. You can login to the Grafana instance to visualise this data. To execute the environment and login:

  1. Start a new command-line interface in your Operating System and run:
    docker-compose up
  2. Login to the local Grafana instance at http://localhost:3000/ NOTE: This assumes that port 3000 is not already in use. If this port is not free, edit the docker-compose.yml file and alter the line
    - "3000:3000"
    
    to some other host port that is free, for example:
    - "3123:3000"
    
  3. Navigate to the MLT dashboard.
  4. Explore the data sources using the Grafana Explorer.

The following is a brief explanation of each of the most important provided components.

Grafana

Grafana is a visualisation tool that allows the creation of dashboards from various data sources. More information can be found here.

The Grafana instance is described in the grafana section of the docker-compose.yml manifest.

It:

  • Mounts two repository directories to provide pre-provisioned data sources for data.
  • A pre-provisioned dashboard for correlating metrics, logs and traces.
  • Exposes port 3000 for local login.
  • Enables two Tempo features, namely span search and service graph support.

No custom configuration is used.

Prometheus

Prometheus is a backend store and service for scraping (pulling) metrics data from various sources. More information can be found here. Additionally, Mimir is a long-term retention store for Prometheus data, information on which can be found here.

The Prometheus instance is described in the prometheus section of the docker-compose.yml manifest.

It is built from a modified Dockerfile in the prometheus directory. This copies a configuration file into the new image as well as enables several features (including Exemplar support) by modifying the command string used on startup. Prometheus exposes its main interface on port 9090.

The configuration file (prometheus/prometheus.yml) defines several scrape jobs, including:

  • Retrieving metrics from the Prometheus instance itself.
  • Metrics from the microservices application.
  • Metrics from the installed Node Exporter instance.

Additionally to the scraped metrics, it also receives remotely written metrics from the Tempo service, which derives metrics from incoming trace spans.

Loki

Loki is a backend store for longterm log retention. More information can be found here.

The Loki instance is described in the loki section of the docker-compose.yml manifest.

This instance is simply the latest Loki image available, and exposes its interface on port 3100.

The microservices application sends its logs directly to the Loki instance in this environment, via its REST API.

Tempo

Tempo is a backend store for longterm trace retention. More information can be found here.

The Tempo instance is described in the tempo section of the docker-compose.yml manifest.

The Tempo service imports a configuration file (tempo/tempo.yaml) that initialises the service with some sensible defaults as well as allowing the receiving of traces in a variety of different formats.

As of Tempo 1.4, the ability to also automatically generate metrics from incoming trace spans is included. As such, this no longer occurs via Grafana Agent.

Grafana Agent

Grafana Agent is a locally installed agent that acts as:

  • A Prometheus scraping service.
  • A Tempo backend service receiver and trace span processor.
  • A Promtail (Loki logs receiver) instance.

Grafana Agent has remote write capabilities that allows it to send metrics, logs and trace data to backend stores (such as Mimir, Loki and Tempo). More information on Grafana Agent can be found here.

Its main role in this environment is to receive trace spans from the microservice application and process them to extract log information before storing them in the final backend stores.

Note that the config now includes a commented section where metrics used to be generated from incoming trace spans; this is now handled directly in Tempo via server-side metrics generation, although the original configuration block has been left commented out in the Agent config.

The configuration file for it can be found in agent/config.yaml.

Comments
  • Grafana cloud

    Grafana cloud

    Added the capability to configure the docker-compose version of intro-to-mlt to send metrics, logs and traces to Grafana Cloud. README.md (line 115+) describes the process to do this using environment variables and the cloud-configure option for ctl.sh.

    opened by daviddryder 4
  • Add rabbitmq and recorder microservice

    Add rabbitmq and recorder microservice

    This adds a third microservice mythical-recorder. Every time the mythical-requester sends a request to mythical-server, it will now also publish a message on the queue so that it can be recorded/archived by the mythical-recorder.

    Purpose: create some interesting traces that pass through a messaging system 👀

    Example of the resulting trace:

    Screenshot 2022-07-13 at 19 01 11

    opened by kvrhdn 2
  • Updates Intro to MLT project.

    Updates Intro to MLT project.

    This entails:

    • Adds APM table.
    • Adding method/target to requester spans.
    • Updating Prometheus to working version (latest will not start).
    • Adding service graph labels for targets/method.

    Signed-off-by: Heds Simons [email protected]

    opened by hedss 0
  • Few general improvements.

    Few general improvements.

    • Fixes a problem with the health check for Rabbit component.
    • Removes extraneous http:// from the exported trace URL.
    • Fixes up the README.
    • Ensures the cloud docker-compose/agent config is up-to-date with new queuing components.

    Signed-off-by: Heds Simons [email protected]

    opened by hedss 0
  • Moves from Grafana Agent metrics to Tempo server-side metrics.

    Moves from Grafana Agent metrics to Tempo server-side metrics.

    This also cleans some of the code up, and fixes an issue with table dropping/recreation every 24 hours.

    Signed-off-by: Heds Simons [email protected]

    opened by hedss 0
Owner
Grafana Labs
Grafana Labs is behind leading open source projects Grafana and Loki, and the creator of the first open & composable observability platform.
Grafana Labs
Sharing short code samples, logs or links is now easier than ever!

Pastebin Sharing short code samples, logs or links is now easier than ever. Explore the docs » • Report Bug • Request Feature • About The Project With

Prasoon Soni 4 Nov 26, 2022
Palaemon is an open-source developer tool for monitoring health and resource metrics of Kubernetes clusters and analyzing Out of Memory (OOMKill) errors

Palaemon ?? ?? An Electron based developer tool for Kubernetes cluster monitoring and error analysis Palaemon is a Greek, child sea-god who came to ai

OSLabs Beta 99 Dec 28, 2022
A visual overview of Kubernetes architecture and Prometheus metrics

A visual overview of Kubernetes architecture and Prometheus metrics. Structure Navigate through the structures page to easily see your control planes

OSLabs Beta 213 Oct 11, 2022
A simple Prometheus (aggregated) push gateway allowing stateless/serverless workloads, ephemeral and batch jobs to easily expose their metrics.

Serverless Prometheus (aggregated) Push Gateway A simple Prometheus (aggregated) push gateway allowing stateless/serverless workloads, ephemeral and b

Adam Janiš 17 Dec 4, 2022
A social network where you can share posts, view your profile metrics and follow other users.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Rui Neto 16 Aug 21, 2022
A Kubernetes monitoring tool to visualize large-scale activity and real-time comprehensive metrics within your cluster.

Armada A light-weight Kubernetes health monitoring tool. Summary Armada is an open-source tool for monitoring the health of your Kubernetes cluster. I

OSLabs Beta 81 Nov 2, 2022
Github action to collect metrics (CPU, memory, I/O, etc ...) from your workflows to help you debug and optimize your CI/CD pipeline

workflow-telemetry-action A GitHub Action to track and monitor the resource metrics of your GitHub Action workflow runs. If the run is triggered via a

Thundra 32 Dec 30, 2022
📊 AlphaSwap subgraph - (Blocks, token info, profiles, pricing data, LP metrics, etc...)

AlphaSwap Subgraph AlphaSwap is a decentralized protocol for automated token exchange on the KCC network. This subgraph dynamically tracks any pair cr

Brandon 3 Jul 9, 2022
An open-source visualization tool for monitoring Kafka cluster metrics

GitHub Tutorial Hyperion An open-source Kafka monitoring tool built for developers hyperionapp.dev Table of Contents About the Project Built With Gett

OSLabs Beta 46 Nov 10, 2022
Companion articles and projects for the Learning TypeScript book.

Website This website is built using Docusaurus 2, a modern static website generator. Installation $ yarn Local Development $ yarn start This command

Josh Goldberg 26 Nov 20, 2022
A Typescript companion to the book A Common-Sense Guide to Data Structures and Algorithms by Jay Wengrow

This repository aims to be a companion to the book A Common-Sense Guide to Data Structures and Algorithms by Jay Wengrow. I rewrote most of the data s

Alexandre Lim 29 Dec 3, 2022
A Travel companion app using Google Maps API, Travel Search and Weather API

Travel Advisor Introduction An advanced Travel Companion Application using Google Maps. With Geolocation, Google Maps API, Searching for places, Fetch

Sunny Bhadani 4 Nov 11, 2022
Companion articles and projects for the Learning TypeScript book.

Website This website is built using Docusaurus 2, a modern static website generator. Installation $ yarn Local Development $ yarn start This command

null 5 May 10, 2022
An unofficial companion tool created for use alongside PhotoPrism to enable API endpoints and automation.

PhotoPrism Helper PhotoPrism Helper is an unofficial companion tool created for use alongside PhotoPrism. This project isn't associated with the Photo

Ryan Miller 9 Dec 25, 2022
Quo is a (free) debugging companion app to help you debug dumped variables, the dumped variables will appear in this Quo client instead of the traditional way which is often tedious.

Quo is a debugging companion to help you debug dumped variables, the dumped variables will appear in this Quo client instead of via the traditional way which is often tedious.

Protoqol 33 Dec 25, 2022
Official companion browser extensions for Kagi Search (Chrome, Firefox)

Kagi Search Extension This contains the source for the Kagi Search extension for Firefox and Chrome. Get it for your browser here: Chrome Firefox Cont

Kagi Search 18 Nov 25, 2022
A cloud based companion app to help keep you safe when you're on the go.

Safe-Travels A cloud based companion app to help keep you safe when you're on the go. Installation Frontend $ git clone https://github.com/6okuJins/Sa

Dom 3 Sep 16, 2022
Kitchen planner companion to the game PlateUp!

PlateUp! Planner Plan your PlateUp! kitchen before you jump into the game. We are not officially affiliated with PlateUp! or its creators. No copyrigh

null 15 Dec 17, 2022
Elections in Russia, Saint Petersburg, 2021: results, turnout, and commission data. With image charts and brief introduction to election fraud methods used.

2021 Elections in Saint Petersburg, Russia ???? Переключиться на русский ?? Jump to charts ?? Telegram bot In Russia, Saint Petersburg from 17th to 19

Vyacheslav 11 Dec 26, 2022