forked from Sonek-HoangBui/apm-agent-go
/
debug.go
31 lines (26 loc) · 873 Bytes
/
debug.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package transport
import (
"context"
"log"
"sync/atomic"
"github.com/elastic/apm-agent-go/internal/pretty"
"github.com/elastic/apm-agent-go/model"
)
type debugTransport struct {
id uint64
transport Transport
}
func (dt *debugTransport) SendTransactions(ctx context.Context, p *model.TransactionsPayload) error {
id := atomic.AddUint64(&dt.id, 1)
log.Printf("elasticapm SendTransactions %d -> %# v", id, pretty.Formatter(p))
err := dt.transport.SendTransactions(ctx, p)
log.Printf("elasticapm SendTransactions %d <- %v", id, err)
return err
}
func (dt *debugTransport) SendErrors(ctx context.Context, p *model.ErrorsPayload) error {
id := atomic.AddUint64(&dt.id, 1)
log.Printf("elasticapm SendErrors %d -> %# v", id, pretty.Formatter(p))
err := dt.transport.SendErrors(ctx, p)
log.Printf("elasticapm SendErrors %d <- %v", id, err)
return err
}