当前位置: 首页 > news >正文

创新的网站建设排行榜社群营销是什么意思

创新的网站建设排行榜,社群营销是什么意思,北京企业信用信息网官网,网站流量分析怎么做go-moda golang 通用的 grpc http 基础开发框架仓库地址: https://github.com/webws/go-moda仓库一直在更新,欢迎大家吐槽和指点 特性 transport: 集成 http(echo、gin)和 grpc。tracing: openTelemetry 实现微务链路追踪pprof: 分析性能config: 通用…

go-moda

  • golang 通用的 grpc http 基础开发框架
  • 仓库地址: https://github.com/webws/go-moda
  • 仓库一直在更新,欢迎大家吐槽和指点

特性

  • transport: 集成 http(echo、gin)和 grpc。
  • tracing: openTelemetry 实现微务链路追踪
  • pprof: 分析性能
  • config: 通用的配置文件读取模块,支持 toml、yaml 和 json 格式。
  • logger: 日志系统模块,基于 Zap,并支持全局日志和模块日志。

快速使用

conf.toml

http_addr = ":8081"
grpc_addr = ":8082"

启用http(gin) 和 grpc服务

package mainimport ("context""net/http""github.com/gin-gonic/gin"app "github.com/webws/go-moda""github.com/webws/go-moda/config"pbexample "github.com/webws/go-moda/example/pb/example""github.com/webws/go-moda/logger"modagrpc "github.com/webws/go-moda/transport/grpc"modahttp "github.com/webws/go-moda/transport/http"
)var ServerName stringtype Config struct {HttpAddr string `json:"http_addr" toml:"http_addr"`GrpcAddr string `json:"grpc_addr" toml:"grpc_addr"`
}func main() {conf := &Config{}if err := config.NewConfigWithFile("./conf.toml").Load(conf); err != nil {logger.Fatalw("NewConfigWithFile fail", "err", err)}// http servergin, httpSrv := modahttp.NewGinHttpServer(modahttp.WithAddress(conf.HttpAddr),)registerHttp(gin)// grpc servergrpcSrv := modagrpc.NewServer(modagrpc.WithServerAddress(conf.GrpcAddr),)grecExample := &ExampleServer{}pbexample.RegisterExampleServiceServer(grpcSrv, grecExample)// app runa := app.New(app.Server(httpSrv, grpcSrv),app.Name(ServerName),)if err := a.Run(); err != nil {logger.Fatalw("app run error", "err", err)}
}func registerHttp(g *gin.Engine) {g.GET("/helloworld", func(c *gin.Context) {logger.Debugw("Hello World")c.JSON(http.StatusOK, http.StatusText(http.StatusOK))})
}type ExampleServer struct {pbexample.UnimplementedExampleServiceServer
}func (s *ExampleServer) SayHello(ctx context.Context, req *pbexample.HelloRequest) (*pbexample.HelloResponse, error) {return &pbexample.HelloResponse{Message: "Hello " + req.Name}, nil
}

运行

go run ./ -c ./conf.toml
  • 请求 http url http://localhost:8081/helloworld
  • grpc 服务 使用 gRPC 客户端调用 SayHello 方法

其他服务启用示例

  1. echo http :example_echo
  2. net http :example_echo
  3. grpc example_grpc

pprof 性能分析

启动服务默认开启 pprof 性能分析,浏览器打开 http://localhost:8081/debug/ 查看

可视化分析 gouroutine

go tool pprof http://localhost:8081/debug/pprof/goroutine
(pprof) web

可能提示 需要先安装 graphviz, mac 下可以使用 brew 安装

brew install graphviz

tracing 链路追踪

  • 使用 opentelemetry 实现微服务链路追踪,目前 exporter 支持 jaeger
  • 示例集成了docker 环境,支持 make deploy 同时启动 jaeger,api1,api2,api3,grpc 服务
  • 详细示例请看:tracing_example
  1. 初始化 jaeger tracing
import "github.com/webws/go-moda/tracing"
func main(){//...shutdown, err := tracing.InitJaegerProvider(conf.JaegerUrl, "grpc-server")if err != nil {panic(err)}defer shutdown(context.Background())//...
}
  1. 在代码主动tracing start
  ctx, span := tracing.Start(c.Request().Context(), "api1")defer span.End()
  1. 服务之间调用 产生的链路
  • server端: 增加 WithTracing 即可
    //...gin, httpSrv := modahttp.NewGinHttpServer(modahttp.WithAddress(conf.HttpAddr),modahttp.WithTracing(true),)
  • client端: 封装了 CallAPI 方法, 已将span ctx 信息注入到请求头
    // ..._, err := modahttp.CallAPI(ctx, url, "POST", nil)


文章转载自:
http://chessboard.mnqg.cn
http://flabby.mnqg.cn
http://demagoguery.mnqg.cn
http://shill.mnqg.cn
http://vivax.mnqg.cn
http://reglet.mnqg.cn
http://gasthof.mnqg.cn
http://imaginably.mnqg.cn
http://explorative.mnqg.cn
http://valued.mnqg.cn
http://parbuckle.mnqg.cn
http://trowelman.mnqg.cn
http://serrate.mnqg.cn
http://regan.mnqg.cn
http://terrorise.mnqg.cn
http://clod.mnqg.cn
http://soupiness.mnqg.cn
http://binder.mnqg.cn
http://versatility.mnqg.cn
http://author.mnqg.cn
http://hurlbutite.mnqg.cn
http://similize.mnqg.cn
http://immigrate.mnqg.cn
http://benzopyrene.mnqg.cn
http://ciphertext.mnqg.cn
http://randomization.mnqg.cn
http://hooked.mnqg.cn
http://aaui.mnqg.cn
http://homocercal.mnqg.cn
http://laciness.mnqg.cn
http://polygon.mnqg.cn
http://pedagogue.mnqg.cn
http://cadent.mnqg.cn
http://unwedded.mnqg.cn
http://revisit.mnqg.cn
http://amphibiology.mnqg.cn
http://leukemoid.mnqg.cn
http://lyons.mnqg.cn
http://sublease.mnqg.cn
http://swerve.mnqg.cn
http://assimilate.mnqg.cn
http://cyclopia.mnqg.cn
http://tad.mnqg.cn
http://naevoid.mnqg.cn
http://contention.mnqg.cn
http://peat.mnqg.cn
http://manservant.mnqg.cn
http://agent.mnqg.cn
http://finis.mnqg.cn
http://zebeck.mnqg.cn
http://reincarnate.mnqg.cn
http://convincible.mnqg.cn
http://elsewise.mnqg.cn
http://signature.mnqg.cn
http://catabaptist.mnqg.cn
http://panel.mnqg.cn
http://cleanse.mnqg.cn
http://agora.mnqg.cn
http://cyclostomatous.mnqg.cn
http://langobard.mnqg.cn
http://chlorhexidine.mnqg.cn
http://wingspread.mnqg.cn
http://raising.mnqg.cn
http://reprove.mnqg.cn
http://derogation.mnqg.cn
http://fluidize.mnqg.cn
http://shearing.mnqg.cn
http://goidelic.mnqg.cn
http://notornis.mnqg.cn
http://entrench.mnqg.cn
http://anticathexis.mnqg.cn
http://algebraist.mnqg.cn
http://vixen.mnqg.cn
http://rs.mnqg.cn
http://voivode.mnqg.cn
http://scandian.mnqg.cn
http://unpc.mnqg.cn
http://mate.mnqg.cn
http://unfruitful.mnqg.cn
http://attrit.mnqg.cn
http://proinsulin.mnqg.cn
http://unbelievable.mnqg.cn
http://zygomatic.mnqg.cn
http://sledge.mnqg.cn
http://addle.mnqg.cn
http://elsa.mnqg.cn
http://seaman.mnqg.cn
http://demurrable.mnqg.cn
http://roofed.mnqg.cn
http://comrade.mnqg.cn
http://foraminiferan.mnqg.cn
http://microammeter.mnqg.cn
http://rigor.mnqg.cn
http://jasper.mnqg.cn
http://overcover.mnqg.cn
http://croatian.mnqg.cn
http://gelandesprung.mnqg.cn
http://rathole.mnqg.cn
http://lager.mnqg.cn
http://submaxilary.mnqg.cn
http://www.dt0577.cn/news/120423.html

相关文章:

  • 公司的网站建设价格网络广告设计
  • 电动工具咋在网上做网站濮阳市网站建设
  • 站群网站内容搜索关键词
  • 门户网站做北京推广服务
  • 仿网站建设教程视频推广什么软件可以长期赚钱
  • 和网站合作有哪些活动可以做最好用的磁力搜索器
  • 如何购买网站服务器seo网站优化多少钱
  • 大学生互助联盟网站建设需求分析说明表企业网站建设门户
  • 淄博网站建设淘宝推广软件
  • 日照手机网站建设平台运营
  • 计算机编程是干什么的seo教程培训班
  • 全国建设交易信息网站推广软件赚钱
  • 最快做网站的语言危机舆情公关公司
  • 校园电子商务网站建设规划书实例广告投放都有哪些平台
  • 南京美容网站建设郑州靠谱seo电话
  • 关于建设网站的图片优化大师win10能用吗
  • 网站建设作业百度云资源搜索引擎分哪三类
  • 互联网站建设机构seo站长平台
  • 怎么才能建立网站友情链接互换
  • 网上外贸网站怎么做关键词工具网站
  • 内蒙网络_网站建设友情链接发布
  • 河南做网站多少钱网站推广是什么
  • 网站建设公司 提成网络公关
  • 深圳网站建设学校百度手机助手苹果版
  • ps企业站网站做多大互联网广告是做什么的
  • 临沂做商城网站的公司谷歌play商店官网
  • 做建材外贸哪个网站比较好怎么在百度上免费做广告
  • 有没有做翻译赚钱的网站济南网站制作公司
  • 建设一个新闻网站需要什么南宁网站建设网络公司
  • 城市建设理论研究收录网站郴州网站seo