1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-08-10 22:31:50 +02:00

sdk/log: remove EnabledParameters.Resource (#6494)

Per
https://github.com/open-telemetry/opentelemetry-specification/pull/4439#discussion_r1980165954
This commit is contained in:
Robert Pająk
2025-03-25 06:44:14 +01:00
committed by GitHub
parent 37b70ce370
commit 84ff4da7ab
4 changed files with 1 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Removed ### Removed
- Drop support for [Go 1.22]. (#6381, #6418) - Drop support for [Go 1.22]. (#6381, #6418)
- Remove `Resource` field from `EnabledParameters` in `go.opentelemetry.io/otel/sdk/log`. (#6494)
### Changed ### Changed

View File

@@ -8,7 +8,6 @@ import (
"go.opentelemetry.io/otel/log" "go.opentelemetry.io/otel/log"
"go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/resource"
) )
// FilterProcessor is a [Processor] that knows, and can identify, what [Record] // FilterProcessor is a [Processor] that knows, and can identify, what [Record]
@@ -56,7 +55,6 @@ type FilterProcessor interface {
// EnabledParameters represents payload for [FilterProcessor]'s Enabled method. // EnabledParameters represents payload for [FilterProcessor]'s Enabled method.
type EnabledParameters struct { type EnabledParameters struct {
Resource resource.Resource
InstrumentationScope instrumentation.Scope InstrumentationScope instrumentation.Scope
Severity log.Severity Severity log.Severity
} }

View File

@@ -50,7 +50,6 @@ func (l *logger) Emit(ctx context.Context, r log.Record) {
// returned if it can be positively verified that no Processor will process. // returned if it can be positively verified that no Processor will process.
func (l *logger) Enabled(ctx context.Context, param log.EnabledParameters) bool { func (l *logger) Enabled(ctx context.Context, param log.EnabledParameters) bool {
p := EnabledParameters{ p := EnabledParameters{
Resource: *l.provider.resource,
InstrumentationScope: l.instrumentationScope, InstrumentationScope: l.instrumentationScope,
Severity: param.Severity, Severity: param.Severity,
} }

View File

@@ -224,9 +224,6 @@ func TestLoggerEnabled(t *testing.T) {
p1 := newFltrProcessor("1", true) p1 := newFltrProcessor("1", true)
p2WithDisabled := newFltrProcessor("2", false) p2WithDisabled := newFltrProcessor("2", false)
emptyResource := resource.Empty()
res := resource.NewSchemaless(attribute.String("key", "value"))
testCases := []struct { testCases := []struct {
name string name string
logger *logger logger *logger
@@ -247,12 +244,10 @@ func TestLoggerEnabled(t *testing.T) {
logger: newLogger(NewLoggerProvider( logger: newLogger(NewLoggerProvider(
WithProcessor(p0), WithProcessor(p0),
WithProcessor(p1), WithProcessor(p1),
WithResource(res),
), instrumentation.Scope{Name: "scope"}), ), instrumentation.Scope{Name: "scope"}),
ctx: context.Background(), ctx: context.Background(),
expected: true, expected: true,
expectedP0Params: []EnabledParameters{{ expectedP0Params: []EnabledParameters{{
Resource: *res,
InstrumentationScope: instrumentation.Scope{Name: "scope"}, InstrumentationScope: instrumentation.Scope{Name: "scope"},
}}, }},
expectedP1Params: nil, expectedP1Params: nil,
@@ -261,7 +256,6 @@ func TestLoggerEnabled(t *testing.T) {
name: "WithDisabledProcessors", name: "WithDisabledProcessors",
logger: newLogger(NewLoggerProvider( logger: newLogger(NewLoggerProvider(
WithProcessor(p2WithDisabled), WithProcessor(p2WithDisabled),
WithResource(emptyResource),
), instrumentation.Scope{}), ), instrumentation.Scope{}),
ctx: context.Background(), ctx: context.Background(),
expected: false, expected: false,
@@ -272,7 +266,6 @@ func TestLoggerEnabled(t *testing.T) {
logger: newLogger(NewLoggerProvider( logger: newLogger(NewLoggerProvider(
WithProcessor(p2WithDisabled), WithProcessor(p2WithDisabled),
WithProcessor(p0), WithProcessor(p0),
WithResource(emptyResource),
), instrumentation.Scope{}), ), instrumentation.Scope{}),
ctx: context.Background(), ctx: context.Background(),
expected: true, expected: true,
@@ -284,7 +277,6 @@ func TestLoggerEnabled(t *testing.T) {
logger: newLogger(NewLoggerProvider( logger: newLogger(NewLoggerProvider(
WithProcessor(p0), WithProcessor(p0),
WithProcessor(p1), WithProcessor(p1),
WithResource(emptyResource),
), instrumentation.Scope{}), ), instrumentation.Scope{}),
ctx: nil, ctx: nil,
expected: true, expected: true,