Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PatchEnvelopes: move PatchEnvelopeAppUsage from App to Metrics #3664

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/pillar/cmd/zedagent/handlemetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@
ReportAppMetric.Memory = new(metrics.MemoryMetric)
ReportAppMetric.AppName = aiStatus.DisplayName
ReportAppMetric.AppID = aiStatus.Key()
ReportAppMetric.PatchEnvelope = composePatchEnvelopeUsage(aiStatus.Key(), ctx)

Check warning on line 701 in pkg/pillar/cmd/zedagent/handlemetrics.go

View check run for this annotation

Codecov / codecov/patch

pkg/pillar/cmd/zedagent/handlemetrics.go#L700-L701

Added lines #L700 - L701 were not covered by tests
if !aiStatus.BootTime.IsZero() && aiStatus.Activated {
elapsed := time.Since(aiStatus.BootTime)
uptime, _ := ptypes.TimestampProto(
Expand Down Expand Up @@ -1055,7 +1057,6 @@
ReportAppInfo.AppVersion = aiStatus.UUIDandVersion.Version
ReportAppInfo.AppName = aiStatus.DisplayName
ReportAppInfo.State = aiStatus.State.ZSwState()
ReportAppInfo.PatchEnvelope = composePatchEnvelopeUsage(aiStatus.UUIDandVersion.UUID.String(), ctx)
if !aiStatus.ErrorTime.IsZero() {
errInfo := encodeErrorInfo(
aiStatus.ErrorAndTimeWithSource.ErrorDescription)
Expand Down
7 changes: 4 additions & 3 deletions pkg/pillar/cmd/zedagent/handlepatchenvelopes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@

"github.com/golang/protobuf/ptypes"
"github.com/lf-edge/eve-api/go/info"
"github.com/lf-edge/eve-api/go/metrics"
"github.com/lf-edge/eve/pkg/pillar/types"
"google.golang.org/protobuf/proto"
)

func composePatchEnvelopeUsage(appUUID string, ctx *zedagentContext) []*info.ZInfoPatchEnvelopeUsage {
result := []*info.ZInfoPatchEnvelopeUsage{}
func composePatchEnvelopeUsage(appUUID string, ctx *zedagentContext) []*metrics.AppPatchEnvelopeMetric {
result := []*metrics.AppPatchEnvelopeMetric{}

Check warning on line 17 in pkg/pillar/cmd/zedagent/handlepatchenvelopes.go

View check run for this annotation

Codecov / codecov/patch

pkg/pillar/cmd/zedagent/handlepatchenvelopes.go#L16-L17

Added lines #L16 - L17 were not covered by tests

for _, c := range ctx.subPatchEnvelopeUsage.GetAll() {
peUsage := c.(types.PatchEnvelopeUsage)
if peUsage.AppUUID == appUUID {
result = append(result, &info.ZInfoPatchEnvelopeUsage{
result = append(result, &metrics.AppPatchEnvelopeMetric{

Check warning on line 22 in pkg/pillar/cmd/zedagent/handlepatchenvelopes.go

View check run for this annotation

Codecov / codecov/patch

pkg/pillar/cmd/zedagent/handlepatchenvelopes.go#L22

Added line #L22 was not covered by tests
Uuid: peUsage.PatchID,
Version: peUsage.Version,
PatchApiCallCount: peUsage.PatchAPICallCount,
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/jackwakefield/gopac v1.0.2
github.com/jaypipes/ghw v0.8.0
github.com/lf-edge/edge-containers v0.0.0-20221025050409-93c34bebadd2
github.com/lf-edge/eve-api/go v0.0.0-20231101130551-3e88f723673a
github.com/lf-edge/eve-api/go v0.0.0-20231214160111-99ce4e43be4b
github.com/lf-edge/eve-libs v0.0.0-20231120160159-666ed2307f8e
github.com/lf-edge/go-qemu v0.0.0-20231121152149-4c467eda0c56
github.com/linuxkit/linuxkit/src/cmd/linuxkit v0.0.0-20220913135124-e532e7310810
Expand Down
4 changes: 2 additions & 2 deletions pkg/pillar/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,8 @@ github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/lf-edge/edge-containers v0.0.0-20221025050409-93c34bebadd2 h1:ckxNk8MEdATh8ZsArR7puG9PI5izRzCT+/TE9dvuAwM=
github.com/lf-edge/edge-containers v0.0.0-20221025050409-93c34bebadd2/go.mod h1:eA41YxPbZRVvewIYRzmqDB1PeLQXxCy9WQEc3AVCsPI=
github.com/lf-edge/eve-api/go v0.0.0-20231101130551-3e88f723673a h1:GDjTYjRchuuCgYsHr1N/uprRmd6iMu2Gmt7mNWJ4d6A=
github.com/lf-edge/eve-api/go v0.0.0-20231101130551-3e88f723673a/go.mod h1:6XqpOM8p1HsluNIGw2ihYPYsaAisQ5CuJpbIKHXQo5w=
github.com/lf-edge/eve-api/go v0.0.0-20231214160111-99ce4e43be4b h1:uxB8HRp0NgOf8tb9nSoVEcMOo8TQ8YdohfSX+q91vnI=
github.com/lf-edge/eve-api/go v0.0.0-20231214160111-99ce4e43be4b/go.mod h1:6XqpOM8p1HsluNIGw2ihYPYsaAisQ5CuJpbIKHXQo5w=
github.com/lf-edge/eve-libs v0.0.0-20231120160159-666ed2307f8e h1:2k1XWU4x8Zkym6Cw1spObpVsyYBCYwB7mIcN8Ge02K8=
github.com/lf-edge/eve-libs v0.0.0-20231120160159-666ed2307f8e/go.mod h1:fca8Jvpk2pnSdbfiCHjbvBE1Mn6WAQqeKyQezaSpLmU=
github.com/lf-edge/go-qemu v0.0.0-20231121152149-4c467eda0c56 h1:LmFp0jbNSwPLuxJA+nQ+mMQrQ53ESkvHP4CVMqR0zrY=
Expand Down
307 changes: 224 additions & 83 deletions pkg/pillar/vendor/github.com/lf-edge/eve-api/go/config/netinst.pb.go

Large diffs are not rendered by default.

Loading
Loading