Skip to content
This repository was archived by the owner on Apr 7, 2024. It is now read-only.

feat: support trace with executables#81

Merged
Wwwsylvia merged 10 commits into
oras-project:mainfrom
wangxiaoxuan273:trace
Jul 13, 2023
Merged

feat: support trace with executables#81
Wwwsylvia merged 10 commits into
oras-project:mainfrom
wangxiaoxuan273:trace

Conversation

@wangxiaoxuan273

Copy link
Copy Markdown
Collaborator

Resolves #63

@codecov-commenter

codecov-commenter commented Jul 4, 2023

Copy link
Copy Markdown

Codecov Report

Merging #81 (14e008a) into main (aff0773) will not change coverage.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@           Coverage Diff           @@
##             main      #81   +/-   ##
=======================================
  Coverage   82.46%   82.46%           
=======================================
  Files           6        6           
  Lines         382      382           
=======================================
  Hits          315      315           
  Misses         45       45           
  Partials       22       22           

@Wwwsylvia

Wwwsylvia commented Jul 4, 2023

Copy link
Copy Markdown
Member

Some general questions:

  1. How should users trace the calls to native store through DynamicStore?
  2. What if users use the context with hook on other stores, like file store?

Comment thread trace/trace.go Outdated
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go Outdated
Comment thread internal/executer/executer.go Outdated
Comment thread internal/executer/executer.go Outdated
Comment thread internal/executer/executer.go Outdated
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go
Comment thread trace/trace.go
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Comment thread internal/executer/executer.go Outdated
Comment thread trace/trace.go Outdated
Comment thread trace/trace.go
Comment thread trace/trace.go Outdated
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Comment thread trace/trace.go Outdated
if oldStart != nil {
start := trace.ExecuteStart
trace.ExecuteStart = func(executableName, action string) {
start(executableName, action)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if start is nil?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the check and refactored this part of code.

Comment thread trace/trace.go Outdated
if oldDone != nil {
done := trace.ExecuteDone
trace.ExecuteDone = func(executableName, action string, err error) {
done(executableName, action, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if done is nil?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the check and refactored this part of code.

Comment thread trace/trace.go Outdated
if trace == nil {
return ctx
}
oldTrace, _ := ctx.Value(executableTraceContextKey{}).(*ExecutableTrace)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ContextExecutableTrace() should be reused for this line.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resued ContextExecutableTrace()

@TerryHowe

Copy link
Copy Markdown
Member

I just wonder why this isn't being added to oras-go

@wangxiaoxuan273

Copy link
Copy Markdown
Collaborator Author

I just wonder why this isn't being added to oras-go

@TerryHowe It will be added to oras-go soon.

Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with suggestions

Comment thread native_store_test.go Outdated
"testing"

"github.com/oras-project/oras-credentials-go/trace"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove empty line

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Comment thread trace/trace.go Outdated
Comment thread native_store_test.go
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>

@Wwwsylvia Wwwsylvia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Wwwsylvia Wwwsylvia merged commit eb1a970 into oras-project:main Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trace support for executables

6 participants