pyroscope 參考使用


基於golang 運行

運行server

brew install pyroscope-io/brew/pyroscope
pyroscope server

golang 代碼

package main
 
import (
    "github.com/gin-gonic/gin"
    "github.com/pyroscope-io/pyroscope/pkg/agent/profiler"
)
 
func main() {
    profiler.Start(profiler.Config{
        ApplicationName: "backend.purchases",
        ServerAddress: "http://localhost:4040",
    })
    r := gin.Default()
    r.GET("/ping", func(c *gin.Context) {
        c.JSON(200, gin.H{
            "message": "pong",
        })
    })
    r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
 

負載

#!/bin/sh
 
while true 
do
    curl -i http://localhost:8080/ping
    sleep 0.1
done
 

效果

 

 

參考資料

https://github.com/pyroscope-io/pyroscope
https://pyroscope.io/docs/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM