Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/sdk/resource`. (#6834)
- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/sdk/trace`. (#6835)
- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/trace`. (#6836)
- `Record.Resource` now returns `*resource.Resource` instead of `resource.Resource` in `go.opentelemetry.io/otel/sdk/log`. (#6864)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion exporters/stdout/stdoutlog/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (e *Exporter) newRecordJSON(r sdklog.Record) recordJSON {

Attributes: make([]keyValue, 0, r.AttributesLen()),

Resource: &res,
Resource: res,
Scope: r.InstrumentationScope(),

DroppedAttributes: r.DroppedAttributes(),
Expand Down
2 changes: 1 addition & 1 deletion sdk/log/logtest/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestRecordFactory(t *testing.T) {
assert.Equal(t, spanID, got.SpanID())
assert.Equal(t, traceFlags, got.TraceFlags())
assert.Equal(t, scope, got.InstrumentationScope())
assert.Equal(t, *r, got.Resource())
assert.Equal(t, r, got.Resource())
}

func TestRecordFactoryMultiple(t *testing.T) {
Expand Down
7 changes: 2 additions & 5 deletions sdk/log/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,8 @@ func (r *Record) SetTraceFlags(flags trace.TraceFlags) {
}

// Resource returns the entity that collected the log.
func (r *Record) Resource() resource.Resource {
if r.resource == nil {
return *resource.Empty()
}
return *r.resource
func (r *Record) Resource() *resource.Resource {
return r.resource
}

// InstrumentationScope returns the scope that the Logger was created with.
Expand Down
2 changes: 1 addition & 1 deletion sdk/log/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestRecordResource(t *testing.T) {
res := resource.NewSchemaless(attribute.Bool("key", true))
r.resource = res
got := r.Resource()
assert.True(t, res.Equal(&got))
assert.Equal(t, res, got)
}

func TestRecordInstrumentationScope(t *testing.T) {
Expand Down
Loading