Skip to content

Commit 2645e92

Browse files
dependabot[bot]mergify[bot]
authored andcommitted
build(deps): bump github.com/elastic/elastic-agent-libs from 0.21.4 to 0.21.6 (#5211)
* build(deps): bump github.com/elastic/elastic-agent-libs Bumps [github.com/elastic/elastic-agent-libs](https://github.com/elastic/elastic-agent-libs) from 0.21.4 to 0.21.6. - [Release notes](https://github.com/elastic/elastic-agent-libs/releases) - [Commits](elastic/elastic-agent-libs@v0.21.4...v0.21.6) --- updated-dependencies: - dependency-name: github.com/elastic/elastic-agent-libs dependency-version: 0.21.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Pass logger to tlscommon functions * Refactoring logger package to avoid import cycle * Post dependabot file modifications * Remove name stutter * Remove ECS naming stutter * Don't share logger --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shaunak Kashyap <[email protected]> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com> (cherry picked from commit 13bea07) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/pkg/api/metrics.go # internal/pkg/api/server.go # internal/pkg/config/output.go # internal/pkg/dl/policies.go # magefile.go
1 parent 9cca2e9 commit 2645e92

File tree

24 files changed

+12731
-199
lines changed

24 files changed

+12731
-199
lines changed

NOTICE-fips.txt

Lines changed: 10261 additions & 0 deletions
Large diffs are not rendered by default.

NOTICE.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,19 @@ SOFTWARE
661661

662662
--------------------------------------------------------------------------------
663663
Dependency : github.com/elastic/elastic-agent-libs
664+
<<<<<<< HEAD
664665
Version: v0.24.0
665666
Licence type (autodetected): Apache-2.0
666667
--------------------------------------------------------------------------------
667668

668669
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]/LICENSE:
670+
=======
671+
Version: v0.21.6
672+
Licence type (autodetected): Apache-2.0
673+
--------------------------------------------------------------------------------
674+
675+
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]/LICENSE:
676+
>>>>>>> 13bea07 (build(deps): bump github.com/elastic/elastic-agent-libs from 0.21.4 to 0.21.6 (#5211))
669677

670678
Apache License
671679
Version 2.0, January 2004

go.mod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ require (
77
github.com/dgraph-io/ristretto v0.2.0
88
github.com/docker/go-units v0.5.0
99
github.com/elastic/elastic-agent-client/v7 v7.17.2
10+
<<<<<<< HEAD
1011
github.com/elastic/elastic-agent-libs v0.24.0
1112
github.com/elastic/elastic-agent-system-metrics v0.11.15
1213
github.com/elastic/go-elasticsearch/v8 v8.17.1
14+
=======
15+
github.com/elastic/elastic-agent-libs v0.21.6
16+
github.com/elastic/elastic-agent-system-metrics v0.11.18
17+
github.com/elastic/go-elasticsearch/v8 v8.19.0
18+
>>>>>>> 13bea07 (build(deps): bump github.com/elastic/elastic-agent-libs from 0.21.4 to 0.21.6 (#5211))
1319
github.com/elastic/go-ucfg v0.8.8
1420
github.com/fxamacker/cbor/v2 v2.8.0
1521
github.com/go-chi/chi/v5 v5.2.3

go.sum

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
3333
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
3434
github.com/elastic/elastic-agent-client/v7 v7.17.2 h1:Cl2TeABqWZgW40t5fchGWT/sRk4MDDLWA0d8iHHOxLA=
3535
github.com/elastic/elastic-agent-client/v7 v7.17.2/go.mod h1:5irRFqp6HLqtu1S+OeY0jg8x7K6PLL+DW+PwVk1vJnk=
36+
<<<<<<< HEAD
3637
github.com/elastic/elastic-agent-libs v0.24.0 h1:8skd0le8Y/zAGVaj4m44ljiJMAp0xuJz07ngDTL/1kM=
3738
github.com/elastic/elastic-agent-libs v0.24.0/go.mod h1:xSeIP3NtOIT4N2pPS4EyURmS1Q8mK0lWZ8Wd1Du6q3w=
3839
github.com/elastic/elastic-agent-system-metrics v0.11.15 h1:RWX0n6LakadsqB6YB2I7AIXyMlEO4qBUGWn4A+aGeKA=
@@ -41,6 +42,16 @@ github.com/elastic/elastic-transport-go/v8 v8.6.1 h1:h2jQRqH6eLGiBSN4eZbQnJLtL4b
4142
github.com/elastic/elastic-transport-go/v8 v8.6.1/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
4243
github.com/elastic/go-elasticsearch/v8 v8.17.1 h1:bOXChDoCMB4TIwwGqKd031U8OXssmWLT3UrAr9EGs3Q=
4344
github.com/elastic/go-elasticsearch/v8 v8.17.1/go.mod h1:MVJCtL+gJJ7x5jFeUmA20O7rvipX8GcQmo5iBcmaJn4=
45+
=======
46+
github.com/elastic/elastic-agent-libs v0.21.6 h1:hvBAi4KHaYf4hn+rTc9m6A35eZjqb1uoE2exklIdWm0=
47+
github.com/elastic/elastic-agent-libs v0.21.6/go.mod h1:xSeIP3NtOIT4N2pPS4EyURmS1Q8mK0lWZ8Wd1Du6q3w=
48+
github.com/elastic/elastic-agent-system-metrics v0.11.18 h1:MuFLvHc3kQN/59+3KmRWhOUoXkL5PDzxEbdYbARGexA=
49+
github.com/elastic/elastic-agent-system-metrics v0.11.18/go.mod h1:qiZC5p1hd8te4XVnhh7FkXdcYhxFnl5i9GJpROtf6zo=
50+
github.com/elastic/elastic-transport-go/v8 v8.7.0 h1:OgTneVuXP2uip4BA658Xi6Hfw+PeIOod2rY3GVMGoVE=
51+
github.com/elastic/elastic-transport-go/v8 v8.7.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
52+
github.com/elastic/go-elasticsearch/v8 v8.19.0 h1:VmfBLNRORY7RZL+9hTxBD97ehl9H8Nxf2QigDh6HuMU=
53+
github.com/elastic/go-elasticsearch/v8 v8.19.0/go.mod h1:F3j9e+BubmKvzvLjNui/1++nJuJxbkhHefbaT0kFKGY=
54+
>>>>>>> 13bea07 (build(deps): bump github.com/elastic/elastic-agent-libs from 0.21.4 to 0.21.6 (#5211))
4455
github.com/elastic/go-structform v0.0.12 h1:HXpzlAKyej8T7LobqKDThUw7BMhwV6Db24VwxNtgxCs=
4556
github.com/elastic/go-structform v0.0.12/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
4657
github.com/elastic/go-sysinfo v1.15.0 h1:54pRFlAYUlVNQ2HbXzLVZlV+fxS7Eax49stzg95M4Xw=

internal/pkg/action/dispatcher.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/elastic/fleet-server/v7/internal/pkg/es"
14-
"github.com/elastic/fleet-server/v7/internal/pkg/logger"
14+
"github.com/elastic/fleet-server/v7/internal/pkg/logger/ecs"
1515
"github.com/elastic/fleet-server/v7/internal/pkg/model"
1616
"github.com/elastic/fleet-server/v7/internal/pkg/monitor"
1717
"github.com/elastic/fleet-server/v7/internal/pkg/sqn"
@@ -84,7 +84,7 @@ func (d *Dispatcher) Subscribe(log zerolog.Logger, agentID string, seqNo sqn.Seq
8484
sz := len(d.subs)
8585
d.mx.Unlock()
8686

87-
log.Trace().Str(logger.AgentID, agentID).Int("sz", sz).Msg("Subscribed to action dispatcher")
87+
log.Trace().Str(ecs.AgentID, agentID).Int("sz", sz).Msg("Subscribed to action dispatcher")
8888

8989
return &sub
9090
}
@@ -101,7 +101,7 @@ func (d *Dispatcher) Unsubscribe(log zerolog.Logger, sub *Sub) {
101101
sz := len(d.subs)
102102
d.mx.Unlock()
103103

104-
log.Trace().Str(logger.AgentID, sub.agentID).Int("sz", sz).Msg("Unsubscribed from action dispatcher")
104+
log.Trace().Str(ecs.AgentID, sub.agentID).Int("sz", sz).Msg("Unsubscribed from action dispatcher")
105105
}
106106

107107
// process gathers actions from the monitor and dispatches them to the corresponding subscriptions.
@@ -167,7 +167,7 @@ func (d *Dispatcher) getSub(agentID string) (Sub, bool) {
167167
func (d *Dispatcher) dispatch(ctx context.Context, agentID string, acdocs []model.Action) {
168168
sub, ok := d.getSub(agentID)
169169
if !ok {
170-
zerolog.Ctx(ctx).Debug().Str(logger.AgentID, agentID).Msg("Agent is not currently connected. Not dispatching actions.")
170+
zerolog.Ctx(ctx).Debug().Str(ecs.AgentID, agentID).Msg("Agent is not currently connected. Not dispatching actions.")
171171
return
172172
}
173173
select {

internal/pkg/api/error.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ import (
2424
"github.com/elastic/fleet-server/v7/internal/pkg/file/uploader"
2525
"github.com/elastic/fleet-server/v7/internal/pkg/limit"
2626
"github.com/elastic/fleet-server/v7/internal/pkg/logger"
27-
27+
"github.com/elastic/fleet-server/v7/internal/pkg/logger/ecs"
2828
"github.com/rs/zerolog"
2929
"github.com/rs/zerolog/hlog"
3030
)
3131

3232
// Alias logger constants
3333
const (
34-
ECSHTTPRequestID = logger.ECSHTTPRequestID
35-
ECSEventDuration = logger.ECSEventDuration
36-
ECSHTTPResponseCode = logger.ECSHTTPResponseCode
37-
ECSHTTPResponseBodyBytes = logger.ECSHTTPResponseBodyBytes
34+
ECSHTTPRequestID = ecs.HTTPRequestID
35+
ECSEventDuration = ecs.EventDuration
36+
ECSHTTPResponseCode = ecs.HTTPResponseCode
37+
ECSHTTPResponseBodyBytes = ecs.HTTPResponseBodyBytes
3838

39-
LogAPIKeyID = logger.APIKeyID
40-
LogPolicyID = logger.PolicyID
41-
LogAgentID = logger.AgentID
42-
LogEnrollAPIKeyID = logger.EnrollAPIKeyID
43-
LogAccessAPIKeyID = logger.AccessAPIKeyID
39+
LogAPIKeyID = ecs.APIKeyID
40+
LogPolicyID = ecs.PolicyID
41+
LogAgentID = ecs.AgentID
42+
LogEnrollAPIKeyID = ecs.EnrollAPIKeyID
43+
LogAccessAPIKeyID = ecs.AccessAPIKeyID
4444
)
4545

4646
// BadRequestErr is used for request validation errors. These can be json

internal/pkg/api/handleAck.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/elastic/fleet-server/v7/internal/pkg/config"
2626
"github.com/elastic/fleet-server/v7/internal/pkg/dl"
2727
"github.com/elastic/fleet-server/v7/internal/pkg/es"
28-
"github.com/elastic/fleet-server/v7/internal/pkg/logger"
28+
"github.com/elastic/fleet-server/v7/internal/pkg/logger/ecs"
2929
"github.com/elastic/fleet-server/v7/internal/pkg/model"
3030
"github.com/elastic/fleet-server/v7/internal/pkg/policy"
3131
"github.com/elastic/fleet-server/v7/internal/pkg/smap"
@@ -243,8 +243,8 @@ func (ack *AckT) handleAckEvents(ctx context.Context, zlog zerolog.Logger, agent
243243
span.Context.SetLabel("agent_id", agent.Agent.ID)
244244
span.Context.SetLabel("action_id", event.ActionId)
245245
log := zlog.With().
246-
Str(logger.ActionID, event.ActionId).
247-
Str(logger.AgentID, event.AgentId).
246+
Str(ecs.ActionID, event.ActionId).
247+
Str(ecs.AgentID, event.AgentId).
248248
Time("timestamp", event.Timestamp).
249249
Int("n", n).Logger()
250250
log.Info().Msg("ack event")
@@ -365,14 +365,14 @@ func (ack *AckT) handleActionResult(ctx context.Context, zlog zerolog.Logger, ag
365365

366366
// Save action result document
367367
if err := dl.CreateActionResult(ctx, ack.bulk, acr); err != nil {
368-
zlog.Error().Err(err).Str(logger.AgentID, agent.Agent.ID).Str(logger.ActionID, action.Id).Msg("create action result")
368+
zlog.Error().Err(err).Str(ecs.AgentID, agent.Agent.ID).Str(ecs.ActionID, action.Id).Msg("create action result")
369369
return err
370370
}
371371

372372
if action.Type == TypeUpgrade {
373373
event, _ := ev.AsUpgradeEvent()
374374
if err := ack.handleUpgrade(ctx, zlog, agent, event); err != nil {
375-
zlog.Error().Err(err).Str(logger.AgentID, agent.Agent.ID).Str(logger.ActionID, action.Id).Msg("handle upgrade event")
375+
zlog.Error().Err(err).Str(ecs.AgentID, agent.Agent.ID).Str(ecs.ActionID, action.Id).Msg("handle upgrade event")
376376
return err
377377
}
378378
}
@@ -397,7 +397,7 @@ func (ack *AckT) handlePolicyChange(ctx context.Context, zlog zerolog.Logger, ag
397397
Str("agent.policyId", agent.PolicyID).
398398
Int64("agent.revisionIdx", currRev).
399399
Str("rev.policyId", rev.PolicyID).
400-
Int64(logger.RevisionIdx, rev.RevisionIdx).
400+
Int64(ecs.RevisionIdx, rev.RevisionIdx).
401401
Msg("ack policy revision")
402402

403403
if ok && rev.PolicyID == agent.PolicyID && rev.RevisionIdx > currRev {
@@ -446,7 +446,7 @@ func (ack *AckT) updateAPIKey(ctx context.Context,
446446
if outputName != "" {
447447
outputBulk := ack.bulk.GetBulker(outputName)
448448
if outputBulk != nil {
449-
zlog.Debug().Str(logger.PolicyOutputName, outputName).Msg("Using output bulker in updateAPIKey")
449+
zlog.Debug().Str(ecs.PolicyOutputName, outputName).Msg("Using output bulker in updateAPIKey")
450450
bulk = outputBulk
451451
}
452452
}
@@ -457,14 +457,14 @@ func (ack *AckT) updateAPIKey(ctx context.Context,
457457
zlog.Warn().
458458
Err(err).
459459
Str(LogAPIKeyID, apiKeyID).
460-
Str(logger.PolicyOutputName, outputName).
460+
Str(ecs.PolicyOutputName, outputName).
461461
Msg("Failed to read API Key roles")
462462
} else {
463463
// race when API key was invalidated before acking
464464
zlog.Info().
465465
Err(err).
466466
Str(LogAPIKeyID, apiKeyID).
467-
Str(logger.PolicyOutputName, outputName).
467+
Str(ecs.PolicyOutputName, outputName).
468468
Msg("Failed to read invalidated API Key roles")
469469

470470
// prevents future checks
@@ -480,14 +480,14 @@ func (ack *AckT) updateAPIKey(ctx context.Context,
480480
Msg("Failed to cleanup roles")
481481
} else if removedRolesCount > 0 {
482482
if err := bulk.APIKeyUpdate(ctx, apiKeyID, permissionHash, clean); err != nil {
483-
zlog.Error().Err(err).RawJSON("roles", clean).Str(LogAPIKeyID, apiKeyID).Str(logger.PolicyOutputName, outputName).Msg("Failed to update API Key")
483+
zlog.Error().Err(err).RawJSON("roles", clean).Str(LogAPIKeyID, apiKeyID).Str(ecs.PolicyOutputName, outputName).Msg("Failed to update API Key")
484484
} else {
485485
zlog.Debug().
486486
Str("hash.sha256", permissionHash).
487487
Str(LogAPIKeyID, apiKeyID).
488488
RawJSON("roles", clean).
489489
Int("removedRoles", removedRolesCount).
490-
Str(logger.PolicyOutputName, outputName).
490+
Str(ecs.PolicyOutputName, outputName).
491491
Msg("Updating agent record to pick up reduced roles.")
492492
}
493493
}
@@ -634,8 +634,8 @@ func (ack *AckT) handleUpgrade(ctx context.Context, zlog zerolog.Logger, agent *
634634
zlog.Info().
635635
Str("lastReportedVersion", agent.Agent.Version).
636636
Str("upgradedAt", now).
637-
Str(logger.AgentID, agent.Agent.ID).
638-
Str(logger.ActionID, event.ActionId).
637+
Str(ecs.AgentID, agent.Agent.ID).
638+
Str(ecs.ActionID, event.ActionId).
639639
Msg("ack upgrade")
640640

641641
return nil
@@ -716,17 +716,17 @@ func invalidateAPIKeys(ctx context.Context, zlog zerolog.Logger, bulk bulk.Bulk,
716716
// read output config from .fleet-policies, not filtering by policy id as agent could be reassigned
717717
policy, err := dl.QueryOutputFromPolicy(ctx, bulk, outputName)
718718
if err != nil || policy == nil {
719-
zlog.Warn().Str(logger.PolicyOutputName, outputName).Any("ids", outputIds).Msg("Output policy not found, API keys will be orphaned")
719+
zlog.Warn().Str(ecs.PolicyOutputName, outputName).Any("ids", outputIds).Msg("Output policy not found, API keys will be orphaned")
720720
} else {
721721
outputBulk, _, err = bulk.CreateAndGetBulker(ctx, zlog, outputName, policy.Data.Outputs)
722722
if err != nil {
723-
zlog.Warn().Str(logger.PolicyOutputName, outputName).Any("ids", outputIds).Msg("Failed to recreate output bulker, API keys will be orphaned")
723+
zlog.Warn().Str(ecs.PolicyOutputName, outputName).Any("ids", outputIds).Msg("Failed to recreate output bulker, API keys will be orphaned")
724724
}
725725
}
726726
}
727727
if outputBulk != nil {
728728
if err := outputBulk.APIKeyInvalidate(ctx, outputIds...); err != nil {
729-
zlog.Info().Err(err).Strs("ids", outputIds).Str(logger.PolicyOutputName, outputName).Msg("Failed to invalidate API keys")
729+
zlog.Info().Err(err).Strs("ids", outputIds).Str(ecs.PolicyOutputName, outputName).Msg("Failed to invalidate API keys")
730730
}
731731
}
732732
}

internal/pkg/api/handleCheckin.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/elastic/fleet-server/v7/internal/pkg/checkin"
2727
"github.com/elastic/fleet-server/v7/internal/pkg/config"
2828
"github.com/elastic/fleet-server/v7/internal/pkg/dl"
29-
"github.com/elastic/fleet-server/v7/internal/pkg/logger"
29+
"github.com/elastic/fleet-server/v7/internal/pkg/logger/ecs"
3030
"github.com/elastic/fleet-server/v7/internal/pkg/model"
3131
"github.com/elastic/fleet-server/v7/internal/pkg/monitor"
3232
"github.com/elastic/fleet-server/v7/internal/pkg/policy"
@@ -258,7 +258,7 @@ func (ct *CheckinT) validateRequest(zlog zerolog.Logger, w http.ResponseWriter,
258258

259259
func (ct *CheckinT) ProcessRequest(zlog zerolog.Logger, w http.ResponseWriter, r *http.Request, start time.Time, agent *model.Agent, ver string) error {
260260
zlog = zlog.With().
261-
Str(logger.AgentID, agent.Id).Logger()
261+
Str(ecs.AgentID, agent.Id).Logger()
262262
validated, err := ct.validateRequest(zlog, w, r, start, agent)
263263
if err != nil {
264264
return err
@@ -299,7 +299,7 @@ func (ct *CheckinT) ProcessRequest(zlog zerolog.Logger, w http.ResponseWriter, r
299299
defer func() {
300300
err := ct.pm.Unsubscribe(sub)
301301
if err != nil {
302-
zlog.Error().Err(err).Str(logger.PolicyID, agent.PolicyID).Msg("unable to unsubscribe from policy")
302+
zlog.Error().Err(err).Str(ecs.PolicyID, agent.PolicyID).Msg("unable to unsubscribe from policy")
303303
}
304304
}()
305305

@@ -327,7 +327,7 @@ func (ct *CheckinT) ProcessRequest(zlog zerolog.Logger, w http.ResponseWriter, r
327327
// 8.16.x releases would incorrectly set unenrolled_at
328328
err = ct.bc.CheckIn(agent.Id, string(req.Status), req.Message, rawMeta, rawComponents, seqno, ver, unhealthyReason, agent.AuditUnenrolledReason != "" || agent.UnenrolledAt != "")
329329
if err != nil {
330-
zlog.Error().Err(err).Str(logger.AgentID, agent.Id).Msg("checkin failed")
330+
zlog.Error().Err(err).Str(ecs.AgentID, agent.Id).Msg("checkin failed")
331331
}
332332

333333
// Initial fetch for pending actions
@@ -382,7 +382,7 @@ func (ct *CheckinT) ProcessRequest(zlog zerolog.Logger, w http.ResponseWriter, r
382382
case <-tick.C:
383383
err := ct.bc.CheckIn(agent.Id, string(req.Status), req.Message, nil, rawComponents, nil, ver, unhealthyReason, false)
384384
if err != nil {
385-
zlog.Error().Err(err).Str(logger.AgentID, agent.Id).Msg("checkin failed")
385+
zlog.Error().Err(err).Str(ecs.AgentID, agent.Id).Msg("checkin failed")
386386
}
387387
}
388388
}
@@ -574,8 +574,8 @@ func (ct *CheckinT) writeResponse(zlog zerolog.Logger, w http.ResponseWriter, r
574574
zlog.Info().
575575
Str("ackToken", fromPtr(resp.AckToken)).
576576
Str("createdAt", action.CreatedAt).
577-
Str(logger.ActionID, action.Id).
578-
Str(logger.ActionType, string(action.Type)).
577+
Str(ecs.ActionID, action.Id).
578+
Str(ecs.ActionType, string(action.Type)).
579579
Str("inputType", action.InputType).
580580
Int64("timeout", fromPtr(action.Timeout)).
581581
Msg("Action delivered to agent on checkin")
@@ -682,7 +682,7 @@ func filterActions(zlog zerolog.Logger, agentID string, actions []model.Action)
682682
resp := make([]model.Action, 0, len(actions))
683683
for _, action := range actions {
684684
if valid := validActionTypes[action.Type]; !valid {
685-
zlog.Info().Str(logger.AgentID, agentID).Str(logger.ActionID, action.ActionID).Str(logger.ActionType, action.Type).Msg("Removing action found in index from check in response")
685+
zlog.Info().Str(ecs.AgentID, agentID).Str(ecs.ActionID, action.ActionID).Str(ecs.ActionType, action.Type).Msg("Removing action found in index from check in response")
686686
continue
687687
}
688688
resp = append(resp, action)
@@ -767,7 +767,7 @@ func convertActions(zlog zerolog.Logger, agentID string, actions []model.Action)
767767
for _, action := range actions {
768768
ad, err := convertActionData(ActionType(action.Type), action.Data)
769769
if err != nil {
770-
zlog.Error().Err(err).Str(logger.ActionID, action.ActionID).Str(logger.ActionType, action.Type).Msg("Failed to convert action.Data")
770+
zlog.Error().Err(err).Str(ecs.ActionID, action.ActionID).Str(ecs.ActionType, action.Type).Msg("Failed to convert action.Data")
771771
continue
772772
}
773773
r := Action{
@@ -818,7 +818,7 @@ func processPolicy(ctx context.Context, zlog zerolog.Logger, bulker bulk.Bulk, a
818818
defer span.End()
819819
zlog = zlog.With().
820820
Str("fleet.ctx", "processPolicy").
821-
Int64(logger.RevisionIdx, pp.Policy.RevisionIdx).
821+
Int64(ecs.RevisionIdx, pp.Policy.RevisionIdx).
822822
Str(LogPolicyID, pp.Policy.PolicyID).
823823
Logger()
824824

internal/pkg/api/metrics.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/elastic/fleet-server/v7/internal/pkg/config"
2626
"github.com/elastic/fleet-server/v7/internal/pkg/dl"
2727
"github.com/elastic/fleet-server/v7/internal/pkg/limit"
28-
"github.com/elastic/fleet-server/v7/internal/pkg/logger"
28+
"github.com/elastic/fleet-server/v7/internal/pkg/logger/zap"
2929
"github.com/elastic/fleet-server/v7/version"
3030
)
3131

@@ -78,6 +78,14 @@ func init() {
7878
cntFileDeliv.Register(routesRegistry.newRegistry("deliverFile"))
7979
cntGetPGP.Register(routesRegistry.newRegistry("getPGPKey"))
8080
cntAuditUnenroll.Register(routesRegistry.newRegistry("auditUnenroll"))
81+
<<<<<<< HEAD
82+
=======
83+
84+
err := report.SetupMetrics(zap.NewStub("instance-metrics"), build.ServiceName, version.DefaultVersion, monitoring.NewRegistry(), registry.registry)
85+
if err != nil {
86+
zerolog.Ctx(context.TODO()).Error().Err(err).Msg("unable to initialize metrics") // TODO is used because this may logged during the package load
87+
}
88+
>>>>>>> 13bea07 (build(deps): bump github.com/elastic/elastic-agent-libs from 0.21.4 to 0.21.6 (#5211))
8189
}
8290

8391
// metricsRegistry wraps libbeat and prometheus registries
@@ -256,7 +264,7 @@ func InitMetrics(ctx context.Context, cfg *config.Config, bi build.Info, tracer
256264
}
257265

258266
// Start local api server; largely for metrics.
259-
zapStub := logger.NewZapStub("fleet-metrics")
267+
zapStub := zap.NewStub("fleet-metrics")
260268
cfgStub, err := cfglib.NewConfigFrom(&cfg.HTTP)
261269
if err != nil {
262270
return nil, err

0 commit comments

Comments
 (0)