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 22, 2024
1 parent afbba84 commit 0c43fa2
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
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ Setting environmental variable ELASTIC_NETINFO:false in Elastic Agent pod will d
- Update CEL extensions library to v1.7.0. {pull}37172[37172]
- 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]
- 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
Original file line number Diff line number Diff line change
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 0c43fa2

Please sign in to comment.