Skip to content

Commit

Permalink
x-pack/filebeat/input/httpjson: propagate request trace configuration…
Browse files Browse the repository at this point in the history
… to chain children

This ensures that all chain child clients will log request traces with the same details
as the top level request trace logger.
  • Loading branch information
efd6 committed Jan 25, 2024
1 parent ac6917c commit 05b56cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Expand Up @@ -168,6 +168,7 @@ Setting environmental variable ELASTIC_NETINFO:false in Elastic Agent pod will d
- Add support for complete URL replacement in HTTPJSON chain steps. {pull}37486[37486]
- Add support for user-defined query selection in EntraID entity analytics provider. {pull}37653[37653]
- Update CEL extensions library to v1.8.0 to provide runtime error location reporting. {issue}37304[37304] {pull}37718[37718]
- Add request trace logging for chained API requests. {issue}37551[36551] {pull}37682[37682]

*Auditbeat*

Expand Down
10 changes: 10 additions & 0 deletions x-pack/filebeat/input/httpjson/input.go
Expand Up @@ -122,6 +122,16 @@ func run(ctx v2.Context, cfg config, pub inputcursor.Publisher, crsr *inputcurso
if cfg.Request.Tracer != nil {
id := sanitizeFileName(ctx.ID)
cfg.Request.Tracer.Filename = strings.ReplaceAll(cfg.Request.Tracer.Filename, "*", id)

// Propagate tracer behaviour to all chain children.
for i, c := range cfg.Chain {
if c.Step != nil { // Request is validated as required.
cfg.Chain[i].Step.Request.Tracer = cfg.Request.Tracer
}
if c.While != nil { // Request is validated as required.
cfg.Chain[i].While.Request.Tracer = cfg.Request.Tracer
}
}
}

metrics := newInputMetrics(reg)
Expand Down

0 comments on commit 05b56cf

Please sign in to comment.