diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 615cb65c803b..61463b8c9441 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,6 +7,11 @@ updates: schedule: interval: "weekly" day: "wednesday" + - package-ecosystem: "gomod" + directory: "/cmd/configschema" + schedule: + interval: "weekly" + day: "wednesday" - package-ecosystem: "gomod" directory: "/cmd/otelcontribcol" schedule: @@ -267,11 +272,6 @@ updates: schedule: interval: "weekly" day: "wednesday" - - package-ecosystem: "gomod" - directory: "/exporter/syslogexporter" - schedule: - interval: "weekly" - day: "wednesday" - package-ecosystem: "gomod" directory: "/exporter/tanzuobservabilityexporter" schedule: diff --git a/extension/encoding/jsonlogencodingextension/README.md b/extension/encoding/jsonlogencodingextension/README.md index 6b1e06e83700..660974f90682 100644 --- a/extension/encoding/jsonlogencodingextension/README.md +++ b/extension/encoding/jsonlogencodingextension/README.md @@ -11,4 +11,4 @@ [development]: https://github.com/open-telemetry/opentelemetry-collector#development -The `jsonlog` encoding extention is used to marshal/unmarshal JSON log body. \ No newline at end of file +The `jsonlog` encoding extension is used to marshal/unmarshal JSON log body, ignoring other log fields. \ No newline at end of file diff --git a/extension/encoding/jsonlogencodingextension/extension.go b/extension/encoding/jsonlogencodingextension/extension.go index c832d4a821bd..ca9987ed3b7a 100644 --- a/extension/encoding/jsonlogencodingextension/extension.go +++ b/extension/encoding/jsonlogencodingextension/extension.go @@ -14,10 +14,10 @@ import ( "go.opentelemetry.io/collector/pdata/plog" ) -type jsonExtension struct { +type jsonLogExtension struct { } -func (e *jsonExtension) MarshalLogs(ld plog.Logs) ([]byte, error) { +func (e *jsonLogExtension) MarshalLogs(ld plog.Logs) ([]byte, error) { logRecord := ld.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Body() var raw map[string]any switch logRecord.Type() { @@ -34,7 +34,7 @@ func (e *jsonExtension) MarshalLogs(ld plog.Logs) ([]byte, error) { } -func (e *jsonExtension) UnmarshalLogs(buf []byte) (plog.Logs, error) { +func (e *jsonLogExtension) UnmarshalLogs(buf []byte) (plog.Logs, error) { p := plog.NewLogs() // get json logs from the buffer @@ -54,10 +54,10 @@ func (e *jsonExtension) UnmarshalLogs(buf []byte) (plog.Logs, error) { return p, nil } -func (e *jsonExtension) Start(_ context.Context, _ component.Host) error { +func (e *jsonLogExtension) Start(_ context.Context, _ component.Host) error { return nil } -func (e *jsonExtension) Shutdown(_ context.Context) error { +func (e *jsonLogExtension) Shutdown(_ context.Context) error { return nil } diff --git a/extension/encoding/jsonlogencodingextension/extension_test.go b/extension/encoding/jsonlogencodingextension/extension_test.go index 0bae53e12409..ef6926e6d75c 100644 --- a/extension/encoding/jsonlogencodingextension/extension_test.go +++ b/extension/encoding/jsonlogencodingextension/extension_test.go @@ -12,7 +12,7 @@ import ( ) func TestExtension_Start_Shutdown(t *testing.T) { - j := &jsonExtension{} + j := &jsonLogExtension{} err := j.Start(context.Background(), componenttest.NewNopHost()) require.NoError(t, err) err = j.Shutdown(context.Background()) diff --git a/extension/encoding/jsonlogencodingextension/factory.go b/extension/encoding/jsonlogencodingextension/factory.go index 17f0304e8e9b..e911dec1958a 100644 --- a/extension/encoding/jsonlogencodingextension/factory.go +++ b/extension/encoding/jsonlogencodingextension/factory.go @@ -22,7 +22,7 @@ func NewFactory() extension.Factory { } func createExtension(_ context.Context, _ extension.CreateSettings, _ component.Config) (extension.Extension, error) { - return &jsonExtension{}, nil + return &jsonLogExtension{}, nil } func createDefaultConfig() component.Config { diff --git a/extension/encoding/jsonlogencodingextension/go.mod b/extension/encoding/jsonlogencodingextension/go.mod index d0c943c53044..598fbc95a438 100644 --- a/extension/encoding/jsonlogencodingextension/go.mod +++ b/extension/encoding/jsonlogencodingextension/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/json-iterator/go v1.1.12 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/collector/component v0.87.0 - go.opentelemetry.io/collector/extension v0.87.0 - go.opentelemetry.io/collector/pdata v1.0.0-rcv0016 + go.opentelemetry.io/collector/component v0.87.1-0.20231017160804-ec0725874313 + go.opentelemetry.io/collector/extension v0.87.1-0.20231017160804-ec0725874313 + go.opentelemetry.io/collector/pdata v1.0.0-rcv0016.0.20231017160804-ec0725874313 ) require ( @@ -23,19 +23,19 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.87.0 // indirect - go.opentelemetry.io/collector/confmap v0.87.0 // indirect - go.opentelemetry.io/collector/featuregate v1.0.0-rcv0016 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.87.1-0.20231017160804-ec0725874313 // indirect + go.opentelemetry.io/collector/confmap v0.87.1-0.20231017160804-ec0725874313 // indirect + go.opentelemetry.io/collector/featuregate v1.0.0-rcv0016.0.20231017160804-ec0725874313 // indirect go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/grpc v1.58.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/extension/encoding/jsonlogencodingextension/go.sum b/extension/encoding/jsonlogencodingextension/go.sum index 0fd693c9c4c1..7e3d62aa6d20 100644 --- a/extension/encoding/jsonlogencodingextension/go.sum +++ b/extension/encoding/jsonlogencodingextension/go.sum @@ -43,18 +43,18 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/collector/component v0.87.0 h1:Q+lwM5WAa2x4a5lgyaF6SjFBpIij5gyjsoiv9KFG36A= -go.opentelemetry.io/collector/component v0.87.0/go.mod h1:LsfDQRkwJRHOSHNnM1/pdi/6EQNj41WpIxpZRqSdI0E= -go.opentelemetry.io/collector/config/configtelemetry v0.87.0 h1:xUqayM9b41OvXkjU3p8RkUr8hUrCjfDUmO+oKhRNSwc= -go.opentelemetry.io/collector/config/configtelemetry v0.87.0/go.mod h1:+LAXM5WFMW/UbTlAuSs6L/W72WC+q8TBJt/6z39FPOU= -go.opentelemetry.io/collector/confmap v0.87.0 h1:LFnyDKIOMtlJm5EsdcFN2t0rcU/QLbS9QEs/awM2HOA= -go.opentelemetry.io/collector/confmap v0.87.0/go.mod h1:inqYRP70+bMrUwGGnuhcWyyufxyU3VQT6rl3/EX0f+g= -go.opentelemetry.io/collector/extension v0.87.0 h1:EMIaEequ5rjWzoid6vNImjQGVMfzbME+8JSa5XACYKs= -go.opentelemetry.io/collector/extension v0.87.0/go.mod h1:D3srNZC99QVTAdLNUVuqfmmgJge4sQHDrnt5XWscvxI= -go.opentelemetry.io/collector/featuregate v1.0.0-rcv0016 h1:/6N9990tbjotvXgrXpV5AbaFiyxTdFEXDypGBHVDSQM= -go.opentelemetry.io/collector/featuregate v1.0.0-rcv0016/go.mod h1:fLmJMf1AoHttkF8p5oJAc4o5ZpHu8yO5XYJ7gbLCLzo= -go.opentelemetry.io/collector/pdata v1.0.0-rcv0016 h1:qCPXSQCoD3qeWFb1RuIks8fw9Atxpk78bmtVdi15KhE= -go.opentelemetry.io/collector/pdata v1.0.0-rcv0016/go.mod h1:OdN0alYOlYhHXu6BDlGehrZWgtBuiDsz/rlNeJeXiNg= +go.opentelemetry.io/collector/component v0.87.1-0.20231017160804-ec0725874313 h1:rQ7OKu7fxWDfNFKU8q7mMr8NVBLY0t3IFlpyglEKnm4= +go.opentelemetry.io/collector/component v0.87.1-0.20231017160804-ec0725874313/go.mod h1:UHArfJc+pijiYXifkEWcq5bNYZyERvGDUQt3r2RnSuU= +go.opentelemetry.io/collector/config/configtelemetry v0.87.1-0.20231017160804-ec0725874313 h1:VugEaPnOkWZ8n5hYlX6lrot0qLXtv9Objvsh8gh/D84= +go.opentelemetry.io/collector/config/configtelemetry v0.87.1-0.20231017160804-ec0725874313/go.mod h1:+LAXM5WFMW/UbTlAuSs6L/W72WC+q8TBJt/6z39FPOU= +go.opentelemetry.io/collector/confmap v0.87.1-0.20231017160804-ec0725874313 h1:IRtWnNC6yOeBBk/2sEq71eQDkdIqPTgPrC/A/CxsG84= +go.opentelemetry.io/collector/confmap v0.87.1-0.20231017160804-ec0725874313/go.mod h1:inqYRP70+bMrUwGGnuhcWyyufxyU3VQT6rl3/EX0f+g= +go.opentelemetry.io/collector/extension v0.87.1-0.20231017160804-ec0725874313 h1:5uUxUkoZkRMVnSNQCKE+hDtg5IY0fvd1D3XYbxpFKDc= +go.opentelemetry.io/collector/extension v0.87.1-0.20231017160804-ec0725874313/go.mod h1:GBJAx4G3Pax5yG06pl6RL9q1fHRnW7/7uP20Zz9Ne/w= +go.opentelemetry.io/collector/featuregate v1.0.0-rcv0016.0.20231017160804-ec0725874313 h1:wzVr3eByIkJnmdmKzfecjhLNGq6bC0rdM4E5rKNlpag= +go.opentelemetry.io/collector/featuregate v1.0.0-rcv0016.0.20231017160804-ec0725874313/go.mod h1:fLmJMf1AoHttkF8p5oJAc4o5ZpHu8yO5XYJ7gbLCLzo= +go.opentelemetry.io/collector/pdata v1.0.0-rcv0016.0.20231017160804-ec0725874313 h1:xVMqIXrZLxP2jH1iRVfvjuVdHRz6TOLzjdz9fyzyZ9I= +go.opentelemetry.io/collector/pdata v1.0.0-rcv0016.0.20231017160804-ec0725874313/go.mod h1:jAsXW4hquZt7NnVqWfFvO8zP0eg9fyCTLqTd9il/MJY= go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= @@ -75,16 +75,16 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= @@ -97,10 +97,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/extension/encoding/jsonlogencodingextension/json_test.go b/extension/encoding/jsonlogencodingextension/json_test.go index cb654363f1f8..8b802cfc211f 100644 --- a/extension/encoding/jsonlogencodingextension/json_test.go +++ b/extension/encoding/jsonlogencodingextension/json_test.go @@ -5,28 +5,18 @@ package jsonlogencodingextension import ( "testing" - "time" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" ) func TestMarshalUnmarshal(t *testing.T) { t.Parallel() - e := &jsonExtension{} + e := &jsonLogExtension{} json := `{"example":"example valid json to test that the unmarshaler is correctly returning a plog value"}` ld, err := e.UnmarshalLogs([]byte(json)) assert.NoError(t, err) assert.Equal(t, 1, ld.LogRecordCount()) - for i := 0; i < ld.ResourceLogs().Len(); i++ { - for j := 0; j < ld.ResourceLogs().At(i).ScopeLogs().Len(); j++ { - for k := 0; k < ld.ResourceLogs().At(i).ScopeLogs().At(j).LogRecords().Len(); k++ { - lr := ld.ResourceLogs().At(i).ScopeLogs().At(j).LogRecords().At(k) - lr.SetObservedTimestamp(pcommon.NewTimestampFromTime(time.Unix(0, 0))) - } - } - } buf, err := e.MarshalLogs(ld) assert.NoError(t, err) @@ -35,7 +25,7 @@ func TestMarshalUnmarshal(t *testing.T) { } func TestInvalidMarshal(t *testing.T) { - e := &jsonExtension{} + e := &jsonLogExtension{} p := plog.NewLogs() p.ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords().AppendEmpty().Body().SetStr("NOT A MAP") _, err := e.MarshalLogs(p) @@ -43,7 +33,7 @@ func TestInvalidMarshal(t *testing.T) { } func TestInvalidUnmarshal(t *testing.T) { - e := &jsonExtension{} + e := &jsonLogExtension{} _, err := e.UnmarshalLogs([]byte("NOT A JSON")) assert.ErrorContains(t, err, "ReadMapCB: expect { or n, but found N") } diff --git a/versions.yaml b/versions.yaml index 18f66f8550de..e8aaf2c434cb 100644 --- a/versions.yaml +++ b/versions.yaml @@ -70,6 +70,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/jaegerencodingextension + - github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/jsonlogencodingextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/textencodingextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/headerssetterextension - github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension