@@ -10,7 +10,6 @@ import (
1010 "errors"
1111 "fmt"
1212 "io"
13- "strconv"
1413 "sync"
1514 "sync/atomic"
1615
@@ -21,7 +20,6 @@ import (
2120 "github.com/DataDog/dd-trace-go/v2/instrumentation/httptrace"
2221 "github.com/DataDog/dd-trace-go/v2/internal/appsec/body"
2322 "github.com/DataDog/dd-trace-go/v2/internal/appsec/body/json"
24- "github.com/DataDog/dd-trace-go/v2/internal/telemetry"
2523)
2624
2725// Processor is a state machine that handles incoming HTTP request and response is a streaming manner
@@ -80,6 +78,7 @@ func (mp *Processor) OnRequestHeaders(ctx context.Context, req RequestHeaders) (
8078 if bodyLimit <= 0 {
8179 mp .instr .Logger ().Info ("external_processing: body parsing size limit set to 0 or negative. The request and response bodies will NOT be analyzed." )
8280 }
81+ RegisterConfig (mp )
8382 mp .instr .Logger ().Info ("external_processing: first request received. Configuration: BlockingUnavailable=%v, BodyParsingSizeLimit=%dB, Framework=%s" , mp .BlockingUnavailable , mp .computedBodyParsingSizeLimit .Load (), mp .Framework )
8483 })
8584
@@ -268,11 +267,7 @@ func processBody(ctx context.Context, bodyBuffer *bodyBuffer, body []byte, eos b
268267 bodyBuffer .append (body )
269268
270269 if eos || bodyBuffer .truncated {
271- telemetry .Distribution (telemetry .NamespaceAppSec , "instrum.body_size" , []string {
272- "direction:" + direction ,
273- "truncated:" + strconv .FormatBool (bodyBuffer .truncated ),
274- }).Submit (float64 (len (bodyBuffer .buffer )))
275-
270+ EmitBodySize (len (bodyBuffer .buffer ), direction , bodyBuffer .truncated )
276271 bodyBuffer .analyzed = true
277272 return analyzeBody (ctx , json .NewEncodableFromData (bodyBuffer .buffer , bodyBuffer .truncated ))
278273 }
0 commit comments