client-consum

Api client para KuberProject con servicios rest implementando el framework gin-gonic https://theboshy.github.io/client-consum/

View the Project on GitHub theboshy/client-consum

Go Report Card License GitHub stars

DOCKERHUB

Client Consum API

Api client para KuberProject con servicios rest implementando el framework gin-gonic

Este servicio se encarga de consumir a KuberProject , por medio de conexion rpc

Despues de resolver la solicitud por API REST , se conectara mediante el protocolo buf , a el servidor tcp en kuberproject

Requerimientos

Build

$ cd ./[<project_path>]

# cosntruir protobuf *pb*
$ protoc -I ./mcs --go_out=plugins=grpc:./pb ./mcs/*.proto

#minikube mantiene un servicio docker el cual podemos usar para generar nuestro contenedor e imagen
$ eval $(minikube docker-env)
#generar la imagen con el servicio ClientConsum
$ docker build -t [<docker_image_name>] -f Dockerfile.api .

#generar el nodo contenedor del servicio cconsum 
$ kubectl apply -f api-deployment.yaml

Archivos descriptores

deployment.yaml

Dockerfile.api

Test

Para comunicarce con el api es necesario conocer su ubicacion dentro del minikube cluster

$ minikube service api-service --url
http://xxx.xxx.xx.xx:xxxx
$ curl http://xxx.xxx.xx.xx:xxxx/gcd/6/2

support [net/http/pprof]

Instalar pprof

net/http/pprof

$ go get github.com/DeanThompson/ginpprof

Profiler End-routers

GET("/debug/pprof/")
GET("/debug/pprof/heap")
GET("/debug/pprof/goroutine")
GET("/debug/pprof/block")
GET("/debug/pprof/threadcreate")
GET("/debug/pprof/cmdline")
GET("/debug/pprof/profile")
GET("/debug/pprof/symbol")
POST("/debug/pprof/symbol")
GET("/debug/pprof/trace")
GET("/debug/pprof/mutex")

Uso de profiler

Nota : este ejemplo se muestra fuera del cluster de minikube localmente

$  go tool pprof goprofex http://localhost:3000/profiler/debug/pprof/profile/
$  go tool pprof goprofex http://localhost:3000/profiler/debug/pprof/heap/

Generar Graficas con Graphviz2.38

Descargar Graphviz

Descargar e instalar con python

$ pip install graphviz

Descargar e instalar con chocolatey

$ choco install graphviz

Instalar

Crear variable de entorno para graphviz en path

captura

Usar Profiler con Graphviz

$ go tool pprof goprofex http://xxx.xxx.xx.xx:xxxx/profiler/debug/pprof/profile/
..... Entering interactive mode 
$ (pprof) web

captura