-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
sdk/log: Add TestRecord #5200
sdk/log: Add TestRecord #5200
Changes from all commits
d6d5638
66c696e
9e395d8
739cd9c
24771ef
c49161f
5abb3d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,3 +233,20 @@ func (r *Record) Clone() Record { | |
res.back = slices.Clone(r.back) | ||
return res | ||
} | ||
|
||
// TestRecord is a log record for testing. | ||
// You can use it for unit testing [Processor] and [Exporter] implementations. | ||
// Do not use TestRecord in production code. | ||
type TestRecord struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be polluting the API with testing types. It also is trying to use a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I propose this as an intermediate solution as noted in the description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather we work on an permanent and intentional solution instead of a stop gap. |
||
Record | ||
} | ||
|
||
// SetResource sets resource for testing. | ||
func (r *TestRecord) SetResource(res *resource.Resource) { | ||
r.resource = res | ||
} | ||
|
||
// SetInstrumentationScope sets the scope for testing. | ||
func (r *TestRecord) SetInstrumentationScope(s instrumentation.Scope) { | ||
r.scope = &s | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I get a
Record
from aTestRecord
so I can use it for testing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Record
. it is used in stdoutlog test in this PR