1 Star 0 Fork 0

Clannad/webkit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
yokaqa 提交于 2024-10-18 10:22 . 111
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package main
import (
"gitee.com/clannad_sk/webkit/v2/frame/g"
"gitee.com/clannad_sk/webkit/v2/net/gtrace"
"gitee.com/clannad_sk/webkit/v2/os/gctx"
)
const (
serviceName = "otlp-http-client"
endpoint = "tracing-analysis-dc-hz.aliyuncs.com"
path = "adapt_******_******/api/otlp/traces"
)
func main() {
var ctx = gctx.New()
shutdown, err := otlphttp.Init(serviceName, endpoint, path)
if err != nil {
g.Log().Fatal(ctx, err)
}
defer shutdown()
StartRequests()
}
// StartRequests starts requests.
func StartRequests() {
ctx, span := gtrace.NewSpan(gctx.New(), "StartRequests")
defer span.End()
ctx = gtrace.SetBaggageValue(ctx, "name", "john")
content := g.Client().GetContent(ctx, "http://127.0.0.1:8199/hello")
g.Log().Print(ctx, content)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/clannad_sk/webkit.git
git@gitee.com:clannad_sk/webkit.git
clannad_sk
webkit
webkit
997199055094

搜索帮助