当前位置:网站首页>Golang - gin - pprof - use and safety
Golang - gin - pprof - use and safety
2022-07-31 13:08:00 【SakuraKizuna】
pprof is a performance analysis tool provided by golang
You can call
project code excerpts by referencing github.com/gin-contrib/pprof directly:
//Performance tuning monitoring TODO Gin hides itself, to be optimizedauthStr := fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(config.ProducerUsername+":"+config.ProducerPassword)))pprofGroup := r.Group("/producer", func(c *gin.Context) {auth := c.Request.Header.Get("Authorization")if auth != authStr {c.Header("www-Authenticate", "Basic")c.AbortWithStatus(http.StatusUnauthorized)return}c.Next()})pprof.RouteRegister(pprofGroup, "flowerxxxxx_pprof")The pprof carried by the Gin framework can be called directly, but it will cause exposure problems in the production environment, resulting in the /debug/pprof interface being exposed to the public network.
We register the interface into a new routing group, and add the Basic ID to the base64 of the (account + colon + password) to trigger the protection mechanism of entering the account and password for access.

Project (small and medium-sized) pprof analysis overview, you can check whether there is a goroutine deadlock or abnormal CPU usage.

边栏推荐
- ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
- STM32——软件SPI控制AD7705[通俗易懂]
- C# 中的Async 和 Await 的用法详解
- JSP response对象简介说明
- 报错IDEA Terminated with exit code 1
- Talk about the message display mechanism on the SAP product UI
- WPF中报错:“未将对象引用设置到对象的实例。”
- Double non-one into bytes!!Pure dry goods sharing
- IDEA连接MySQL数据库并执行SQL查询操作
- C# List用法 List介绍
猜你喜欢

Character Functions and String Functions

Hard disk partition, expand disk C, no reshipment system, not heavy D dish of software full tutorial.

ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法

PyQt5快速开发与实战 9.7 UI层的自动化测试

The 2nd activity of the TOGAF10 Standard Reading Club continues wonderfully, and the highlights will be reviewed!

C#控件 ToolStripProgressBar 用法

C#控件CheckBox的使用

CentOS7 安装MySQL 图文详细教程

Invalid bound statement (not found)出现的原因和解决方法

365天挑战LeetCode1000题——Day 044 最大层内元素和 层次遍历
随机推荐
C#控件CheckBox的使用
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
PyQt5 rapid development and actual combat 10.1 Get city weather forecast
Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法
Centos7 install mysql5.7 steps (graphical version)
Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
知名无人驾驶公司:文远知行内推
MATLAB | 我也做了一套绘图配色可视化模板
基于改进YOLOv5的轻量化航空目标检测方法
SAP message TK 248 solved
如何使用StarUML画类图[通俗易懂]
深圳某游戏研发公司每个工位都装监控,网友:堪比“坐牢”!
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
STM32——软件SPI控制AD7705[通俗易懂]
centos7安装mysql5.7
IDEA的database使用教程(使用mysql数据库)
聊聊 SAP 产品 UI 上的消息显示机制
生产力工具和插件
【CPU设计实战】简单流水线CPU设计
Using SQL Server FOR XML and FOR JSON syntax on other RDBMSs with jOOQ