|
|
@@ -327,6 +327,37 @@ func (t *Trace) MysqlTraceQueryEvent(query string, r *l7.RequestData, destinatio
|
|
|
t.createTraceEvent(l7.ProtocolMysql.String(), int(ebpftracer.EventTypeL7Request), int(l7.ProtocolMysql), attr...)
|
|
|
}
|
|
|
|
|
|
+func (t *Trace) PostGreSqlTraceQuery(query string, error bool, duration time.Duration, destination netaddr.IPPort) {
|
|
|
+ if t == nil || query == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ t.createTraceSpan(l7.ProtocolPostgres.String(), duration, error,
|
|
|
+ semconv.DBSystemPostgreSQL,
|
|
|
+ semconv.DBStatement(query),
|
|
|
+ semconv.NetPeerName(destination.IP().String()),
|
|
|
+ semconv.NetPeerPort(int(destination.Port())),
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+func (t *Trace) PostGreSqlTraceQueryEvent(query string, r *l7.RequestData, destination netaddr.IPPort) {
|
|
|
+ fmt.Println("query", query)
|
|
|
+ if t == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var attr []attribute.KeyValue
|
|
|
+ attr = append(attr,
|
|
|
+ semconv.DBSystemPostgreSQL,
|
|
|
+ semconv.DBStatement(query),
|
|
|
+ semconv.NetPeerName(destination.IP().String()),
|
|
|
+ semconv.NetPeerPort(int(destination.Port())),
|
|
|
+ attribute.String("sql.src_addr", r.ComponentSAddr.String()),
|
|
|
+ attribute.String("sql.destination_addr", r.ComponentDAddr.String()),
|
|
|
+ )
|
|
|
+ t.appendTimestamp(&attr, r.StartAt, r.EndAt, r.Duration.Nanoseconds())
|
|
|
+ t.createTraceEvent(l7.ProtocolPostgres.String(), int(ebpftracer.EventTypeL7Request), int(l7.ProtocolPostgres), attr...)
|
|
|
+}
|
|
|
+
|
|
|
func (t *Trace) DmTraceQueryEvent(query string, r *l7.RequestData, destination netaddr.IPPort) {
|
|
|
if t == nil || query == "" {
|
|
|
return
|