Trendyol / chaki

Chaki is an application builder framework designed to simplify the development process in Go
https://trendyol.github.io/chaki/
MIT License
27 stars 2 forks source link

Integration with pprof and adding dashboard #29

Closed templatedop closed 2 months ago

templatedop commented 2 months ago

Can we integrate with pprof Request to please help in understand how to integrate pprof in chaki. Thank you.

ahmetcanozcan commented 2 months ago

Hey, You can write a pproff module that has basic functionalities. and this module can be used with app.Use . And fiber has pproff middleware. so this could be a good boilerplate code for pprof module.

package pprof

import (
    "github.com/Trendyol/chaki/config"
    "github.com/Trendyol/chaki/module"
    "github.com/gofiber/fiber/v2"
    "github.com/gofiber/fiber/v2/middleware/pprof"
)

func Module() *module.Module {
    return module.New(ModuleName).Provide(newPproffMiddleware)
}

func newPproffMiddleware(cfg *config.Config) fiber.Handler {
    // TODO: build pprof.Config using config instance
    c := pprof.Config{}
    return pprof.New(c)
}
templatedop commented 2 months ago

Thank you