Giter VIP home page Giter VIP logo

go_runtime_grafana's Introduction

go_runtime_grafana

This repository provides a Grafana dashboard, exported as JSON, for monitoring GOLang runtime of applications in a DC based setup where a given application is deployed on a cluster of servers in a given Data center (on prem or cloud). This dashboard groups together servers by the services being run on them, and services by the DC they are being served from.

It is possible to select one or multiple DC, and one or multiple hosts for a given service to compare metrics cross hosts and cross DC.

This requires runtime metrics to be exported by the application using prometheus client library for GOLang

Exporting GOLang metrices

Given below is a simple, tiny code snippet for enabling your application to expose prometheus metrics at /metrics endpoint

package main

import (
        "net/http"
        "github.com/prometheus/client_golang/prometheus/promhttp"
)


func main() {

        http.Handle("/metrics/", promhttp.Handler())
        http.ListenAndServe(":8888", nil)
}

This will expose Go runtime metrics at http://127.0.0.1:8888/metrics

You can send custom metrics to. You can find out more about instrumenting your GOLang app with Prometheus at ther offician documentation.

Adding a target in Prometheus

Your target must have 3 labels attached to them. These are as follows

  • dc - The dc where this service and its hosts are deployed. This is just a nomenclature, you can group your service by cluster, team, or any other nomenclature.

  • service - Name of the service

  • hostname - Name of the server or anything that will uniquely identify the server.

Example target configuration:

- job_name: 'mygoapp-1-dc-1'
    static_configs:
      - targets: ['127.0.0.1:2112']
        labels:
            dc: "dc1"
            hostname: "my-goapp-1-server-1"
            service: "mygoapp-1"
      - targets: ['127.0.0.1:2113']
        labels:
            dc: "dc1"
            hostname: "mygoapp-1-server-2"
            service: "mygoapp-1"
- job_name: 'mygoapp-2-dc-1'
    static_configs:
      - targets: ['127.0.0.1:2114']
        labels:
            dc: "dc1"
            hostname: "my-goapp-2-server-1"
            service: "mygoapp-2"
      - targets: ['127.0.0.1:2114']
        labels:
            dc: "dc1"
            hostname: "mygoapp-2-server-2"
            service: "mygoapp-2"
 

Monitored metrices

Some of the runtime metrics this dashboard visualises :

  • Process resident memory
  • Process virtual memory
  • Stack memory
  • Heap memory
  • Allocs
  • Open file descriptors
  • Pointer dereference
  • Number of Goroutines
  • Number of OS threads
  • GC time

How it looks like

go_runtime_grafana's People

Contributors

djmgit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.