mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
@ -55,7 +55,7 @@ func (c *Core) addSqlToTracing(ctx context.Context, sql *Sql) {
|
||||
labels = append(labels, gtrace.CommonLabels()...)
|
||||
labels = append(labels,
|
||||
attribute.String(tracingAttrDbType, c.db.GetConfig().Type),
|
||||
attribute.String(string(semconv.DBStatementKey), sql.Format),
|
||||
semconv.DBStatementKey.String(sql.Format),
|
||||
)
|
||||
if c.db.GetConfig().Host != "" {
|
||||
labels = append(labels, attribute.String(tracingAttrDbHost, c.db.GetConfig().Host))
|
||||
|
||||
@ -12,12 +12,13 @@ import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
|
||||
"github.com/gogf/gf/v2/container/gmap"
|
||||
"github.com/gogf/gf/v2/container/gtype"
|
||||
"github.com/gogf/gf/v2/os/gcache"
|
||||
"github.com/gogf/gf/v2/os/gsession"
|
||||
"github.com/gogf/gf/v2/protocol/goai"
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -132,7 +133,7 @@ const (
|
||||
contentTypeHtml = "text/html"
|
||||
contentTypeJson = "application/json"
|
||||
swaggerUIPackedPath = "/goframe/swaggerui"
|
||||
responseTraceIdHeader = "Trace-Id"
|
||||
responseTraceIDHeader = "Trace-ID"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -143,7 +143,7 @@ func (r *Response) ClearBuffer() {
|
||||
|
||||
// Flush outputs the buffer content to the client and clears the buffer.
|
||||
func (r *Response) Flush() {
|
||||
r.Header().Set(responseTraceIdHeader, gtrace.GetTraceID(r.Request.Context()))
|
||||
r.Header().Set(responseTraceIDHeader, gtrace.GetTraceID(r.Request.Context()))
|
||||
if r.Server.config.ServerAgent != "" {
|
||||
r.Header().Set("Server", r.Server.config.ServerAgent)
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/net/gtrace/internal/provider"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
@ -23,6 +22,7 @@ import (
|
||||
"github.com/gogf/gf/v2/container/gvar"
|
||||
"github.com/gogf/gf/v2/internal/command"
|
||||
"github.com/gogf/gf/v2/net/gipv4"
|
||||
"github.com/gogf/gf/v2/net/gtrace/internal/provider"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user