From 946ac1fdcebf0f1a9036bd7a27cc2701e1feeb1a Mon Sep 17 00:00:00 2001 From: Dmitrii Anoshin Date: Mon, 30 Oct 2023 14:34:45 -0700 Subject: [PATCH] [extension/encoding] Introduce interfaces for encoding extensions (#28688) **Description:** We should have explicit interfaces for the encoding extensions, which should be used by the receivers/exporters instead of marshallers and unmarshallers **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/28686 --- .chloggen/encoding-extensions-interfaces.yaml | 12 ++ .github/CODEOWNERS | 5 +- .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + .github/ISSUE_TEMPLATE/other.yaml | 1 + .github/dependabot.yml | 6 +- cmd/checkapi/allowlist.txt | 1 + extension/encoding/Makefile | 1 + extension/encoding/encoding.go | 47 ++++++++ extension/encoding/go.mod | 37 +++++++ extension/encoding/go.sum | 104 ++++++++++++++++++ .../jaegerencodingextension/extension.go | 4 +- .../encoding/jaegerencodingextension/go.mod | 3 + .../jsonlogencodingextension/extension.go | 7 ++ .../encoding/jsonlogencodingextension/go.mod | 3 + extension/encoding/metadata.yaml | 3 + .../otlpencodingextension/extension.go | 15 +-- .../encoding/otlpencodingextension/go.mod | 3 + .../textencodingextension/extension.go | 7 +- .../encoding/textencodingextension/go.mod | 3 + .../zipkinencodingextension/config.go | 1 + .../zipkinencodingextension/extension.go | 5 +- .../encoding/zipkinencodingextension/go.mod | 3 + versions.yaml | 1 + 24 files changed, 257 insertions(+), 17 deletions(-) create mode 100644 .chloggen/encoding-extensions-interfaces.yaml create mode 100644 extension/encoding/Makefile create mode 100644 extension/encoding/encoding.go create mode 100644 extension/encoding/go.mod create mode 100644 extension/encoding/go.sum create mode 100644 extension/encoding/metadata.yaml diff --git a/.chloggen/encoding-extensions-interfaces.yaml b/.chloggen/encoding-extensions-interfaces.yaml new file mode 100644 index 000000000000..80187ba6c03d --- /dev/null +++ b/.chloggen/encoding-extensions-interfaces.yaml @@ -0,0 +1,12 @@ +# Use this changelog template to create an entry for release notes. +change_type: enhancement + +component: extension/encoding + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Introduce interfaces for encoding extensions. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [28686] + +change_logs: [api] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 171b11ae4e34..1d27470e335e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -91,11 +91,12 @@ extension/asapauthextension/ @open-te extension/awsproxy/ @open-telemetry/collector-contrib-approvers @Aneurysm9 @mxiamxia extension/basicauthextension/ @open-telemetry/collector-contrib-approvers @jpkrohling @svrakitin @frzifus extension/bearertokenauthextension/ @open-telemetry/collector-contrib-approvers @jpkrohling @frzifus +extension/encoding/ @open-telemetry/collector-contrib-approvers @atoulme @dao-jun @dmitryax @MovieStoreGuy @VihasMakwana extension/encoding/jaegerencodingextension/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @atoulme extension/encoding/jsonlogencodingextension/ @open-telemetry/collector-contrib-approvers @VihasMakwana @atoulme +extension/encoding/otlpencodingextension/ @open-telemetry/collector-contrib-approvers @dao-jun @VihasMakwana extension/encoding/textencodingextension/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @atoulme -extension/encoding/zipkinencodingextension/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @dao-jun -extension/encoding/otlpencodingextension/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @dao-jun +extension/encoding/zipkinencodingextension/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @dao-jun extension/headerssetterextension/ @open-telemetry/collector-contrib-approvers @jpkrohling extension/healthcheckextension/ @open-telemetry/collector-contrib-approvers @jpkrohling extension/httpforwarder/ @open-telemetry/collector-contrib-approvers @atoulme @rmfitzpatrick diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 06cebb6ea4c4..d1d91220666a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -83,6 +83,7 @@ body: - extension/awsproxy - extension/basicauth - extension/bearertokenauth + - extension/encoding - extension/encoding/jaegerencoding - extension/encoding/jsonlogencoding - extension/encoding/otlpencoding diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 416ae42f4817..10256f615027 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -77,6 +77,7 @@ body: - extension/awsproxy - extension/basicauth - extension/bearertokenauth + - extension/encoding - extension/encoding/jaegerencoding - extension/encoding/jsonlogencoding - extension/encoding/otlpencoding diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index 3be4ed50db70..9a033cb3b277 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -77,6 +77,7 @@ body: - extension/awsproxy - extension/basicauth - extension/bearertokenauth + - extension/encoding - extension/encoding/jaegerencoding - extension/encoding/jsonlogencoding - extension/encoding/otlpencoding diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4764786710c5..e297110c4f41 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -283,17 +283,17 @@ updates: interval: "weekly" day: "wednesday" - package-ecosystem: "gomod" - directory: "/extension/encoding/jaegerencodingextension" + directory: "/extension/encoding" schedule: interval: "weekly" day: "wednesday" - package-ecosystem: "gomod" - directory: "/extension/encoding/jsonlogencodingextension" + directory: "/extension/encoding/jaegerencodingextension" schedule: interval: "weekly" day: "wednesday" - package-ecosystem: "gomod" - directory: "/extension/encoding/otlpencodingextension" + directory: "/extension/encoding/jsonlogencodingextension" schedule: interval: "weekly" day: "wednesday" diff --git a/cmd/checkapi/allowlist.txt b/cmd/checkapi/allowlist.txt index feb33d18c7d3..683be95a7acd 100644 --- a/cmd/checkapi/allowlist.txt +++ b/cmd/checkapi/allowlist.txt @@ -1,4 +1,5 @@ connector/servicegraphconnector +extension/encoding extension/observer processor/servicegraphprocessor receiver/carbonreceiver diff --git a/extension/encoding/Makefile b/extension/encoding/Makefile new file mode 100644 index 000000000000..ded7a36092dc --- /dev/null +++ b/extension/encoding/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common diff --git a/extension/encoding/encoding.go b/extension/encoding/encoding.go new file mode 100644 index 000000000000..1981420a0130 --- /dev/null +++ b/extension/encoding/encoding.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package encoding // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding" + +import ( + "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pdata/ptrace" +) + +// LogsMarshalerExtension is an extension that marshals logs. +type LogsMarshalerExtension interface { + extension.Extension + plog.Marshaler +} + +// LogsUnmarshalerExtension is an extension that unmarshals logs. +type LogsUnmarshalerExtension interface { + extension.Extension + plog.Unmarshaler +} + +// MetricsMarshalerExtension is an extension that marshals metrics. +type MetricsMarshalerExtension interface { + extension.Extension + pmetric.Marshaler +} + +// MetricsUnmarshalerExtension is an extension that unmarshals metrics. +type MetricsUnmarshalerExtension interface { + extension.Extension + pmetric.Unmarshaler +} + +// TracesMarshalerExtension is an extension that marshals traces. +type TracesMarshalerExtension interface { + extension.Extension + ptrace.Marshaler +} + +// TracesUnmarshalerExtension is an extension that unmarshals traces. +type TracesUnmarshalerExtension interface { + extension.Extension + ptrace.Unmarshaler +} diff --git a/extension/encoding/go.mod b/extension/encoding/go.mod new file mode 100644 index 000000000000..8ebd8972a4e4 --- /dev/null +++ b/extension/encoding/go.mod @@ -0,0 +1,37 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding + +go 1.20 + +require ( + go.opentelemetry.io/collector/extension v0.88.1-0.20231026220224-6405e152a2d9 + go.opentelemetry.io/collector/pdata v1.0.0-rcv0017.0.20231026220224-6405e152a2d9 +) + +require ( + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/providers/confmap v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.0.1 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + go.opentelemetry.io/collector/component v0.88.1-0.20231026220224-6405e152a2d9 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.88.1-0.20231026220224-6405e152a2d9 // indirect + go.opentelemetry.io/collector/confmap v0.88.1-0.20231026220224-6405e152a2d9 // indirect + go.opentelemetry.io/collector/featuregate v1.0.0-rcv0017.0.20231026220224-6405e152a2d9 // 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.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-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect +) diff --git a/extension/encoding/go.sum b/extension/encoding/go.sum new file mode 100644 index 000000000000..544af05fef61 --- /dev/null +++ b/extension/encoding/go.sum @@ -0,0 +1,104 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= +github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= +github.com/knadh/koanf/v2 v2.0.1 h1:1dYGITt1I23x8cfx8ZnldtezdyaZtfAuRtIFOiRzK7g= +github.com/knadh/koanf/v2 v2.0.1/go.mod h1:ZeiIlIDXTE7w1lMT6UVcNiRAS2/rCeLn/GdLNvY1Dus= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 h1:BpfhmLKZf+SjVanKKhCgf3bg+511DmU9eDQTen7LLbY= +github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +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.88.1-0.20231026220224-6405e152a2d9 h1:t9GCaQDZ1MDBjEAC1Y7NvwiqvVppK6ckAfrUEAlFioA= +go.opentelemetry.io/collector/component v0.88.1-0.20231026220224-6405e152a2d9/go.mod h1:4utKxz4Lilym3SPxNXJHosdaTjT1aQxI+TCmnJO54pU= +go.opentelemetry.io/collector/config/configtelemetry v0.88.1-0.20231026220224-6405e152a2d9 h1:4WPy3qE1lJE1LZE7t1kAj1XSZN85w68JknZO5Uo00vw= +go.opentelemetry.io/collector/config/configtelemetry v0.88.1-0.20231026220224-6405e152a2d9/go.mod h1:+LAXM5WFMW/UbTlAuSs6L/W72WC+q8TBJt/6z39FPOU= +go.opentelemetry.io/collector/confmap v0.88.1-0.20231026220224-6405e152a2d9 h1:JKFChlNpigR1Q4hZUjDU2sB2VuQ+RigAh7oOQfdcaiQ= +go.opentelemetry.io/collector/confmap v0.88.1-0.20231026220224-6405e152a2d9/go.mod h1:CSJlMk1KRZloXAygpiPeCLpuQiLVDEZYbGsGHIKHeUg= +go.opentelemetry.io/collector/extension v0.88.1-0.20231026220224-6405e152a2d9 h1:6lnGLRgbuTQR7sR1xRqTfJMX2UNkOKbqVAwJDzobvGY= +go.opentelemetry.io/collector/extension v0.88.1-0.20231026220224-6405e152a2d9/go.mod h1:5wPlOyWtVJcZS9CMhFUnuRvNQ0XIoV/iUSaZWtCjoHA= +go.opentelemetry.io/collector/featuregate v1.0.0-rcv0017.0.20231026220224-6405e152a2d9 h1:luvDPu+FNy6LIylBOO8PH/ca6ym7JKAdMe1J1aJbsF4= +go.opentelemetry.io/collector/featuregate v1.0.0-rcv0017.0.20231026220224-6405e152a2d9/go.mod h1:fLmJMf1AoHttkF8p5oJAc4o5ZpHu8yO5XYJ7gbLCLzo= +go.opentelemetry.io/collector/pdata v1.0.0-rcv0017.0.20231026220224-6405e152a2d9 h1:TVYPzf0ZwFDTSoQ6gPk4lpQgVK4g43cWYuo710E0RHI= +go.opentelemetry.io/collector/pdata v1.0.0-rcv0017.0.20231026220224-6405e152a2d9/go.mod h1:Rv9fOclA5AtM/JGm0d4jBOIAo1+jBA13UT5Bx0ovXi4= +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= +go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= +go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +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.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.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= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +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-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= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/extension/encoding/jaegerencodingextension/extension.go b/extension/encoding/jaegerencodingextension/extension.go index 8fb2466fd89f..cb36cfcd8f6e 100644 --- a/extension/encoding/jaegerencodingextension/extension.go +++ b/extension/encoding/jaegerencodingextension/extension.go @@ -9,9 +9,11 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/ptrace" + + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding" ) -var _ ptrace.Unmarshaler = &jaegerExtension{} +var _ encoding.TracesUnmarshalerExtension = &jaegerExtension{} type jaegerExtension struct { config *Config diff --git a/extension/encoding/jaegerencodingextension/go.mod b/extension/encoding/jaegerencodingextension/go.mod index ac931f1bb359..21a15fcf912d 100644 --- a/extension/encoding/jaegerencodingextension/go.mod +++ b/extension/encoding/jaegerencodingextension/go.mod @@ -4,6 +4,7 @@ go 1.20 require ( github.com/jaegertracing/jaeger v1.49.0 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding v0.0.0-00010101000000-000000000000 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.88.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.88.1-0.20231026220224-6405e152a2d9 @@ -54,3 +55,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger => ../../../pkg/translator/jaeger replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding => ../ diff --git a/extension/encoding/jsonlogencodingextension/extension.go b/extension/encoding/jsonlogencodingextension/extension.go index ca9987ed3b7a..faac8f466f65 100644 --- a/extension/encoding/jsonlogencodingextension/extension.go +++ b/extension/encoding/jsonlogencodingextension/extension.go @@ -12,6 +12,13 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" + + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding" +) + +var ( + _ encoding.LogsMarshalerExtension = (*jsonLogExtension)(nil) + _ encoding.LogsUnmarshalerExtension = (*jsonLogExtension)(nil) ) type jsonLogExtension struct { diff --git a/extension/encoding/jsonlogencodingextension/go.mod b/extension/encoding/jsonlogencodingextension/go.mod index eb8c6cca26f9..efd6c2490ba4 100644 --- a/extension/encoding/jsonlogencodingextension/go.mod +++ b/extension/encoding/jsonlogencodingextension/go.mod @@ -4,6 +4,7 @@ go 1.20 require ( github.com/json-iterator/go v1.1.12 + github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding v0.0.0-00010101000000-000000000000 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.88.1-0.20231026220224-6405e152a2d9 go.opentelemetry.io/collector/extension v0.88.1-0.20231026220224-6405e152a2d9 @@ -39,3 +40,5 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding => ../ diff --git a/extension/encoding/metadata.yaml b/extension/encoding/metadata.yaml new file mode 100644 index 000000000000..bb8050691efe --- /dev/null +++ b/extension/encoding/metadata.yaml @@ -0,0 +1,3 @@ +status: + codeowners: + active: [atoulme, dao-jun, dmitryax, MovieStoreGuy, VihasMakwana] diff --git a/extension/encoding/otlpencodingextension/extension.go b/extension/encoding/otlpencodingextension/extension.go index b2866beb6c67..748f0a536e5a 100644 --- a/extension/encoding/otlpencodingextension/extension.go +++ b/extension/encoding/otlpencodingextension/extension.go @@ -11,6 +11,8 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding" ) const ( @@ -19,13 +21,12 @@ const ( ) var ( - _ component.Component = (*otlpExtension)(nil) - _ ptrace.Marshaler = (*otlpExtension)(nil) - _ ptrace.Unmarshaler = (*otlpExtension)(nil) - _ plog.Marshaler = (*otlpExtension)(nil) - _ plog.Unmarshaler = (*otlpExtension)(nil) - _ pmetric.Marshaler = (*otlpExtension)(nil) - _ pmetric.Unmarshaler = (*otlpExtension)(nil) + _ encoding.TracesMarshalerExtension = (*otlpExtension)(nil) + _ encoding.TracesUnmarshalerExtension = (*otlpExtension)(nil) + _ encoding.LogsMarshalerExtension = (*otlpExtension)(nil) + _ encoding.LogsUnmarshalerExtension = (*otlpExtension)(nil) + _ encoding.MetricsMarshalerExtension = (*otlpExtension)(nil) + _ encoding.MetricsUnmarshalerExtension = (*otlpExtension)(nil) ) type otlpExtension struct { diff --git a/extension/encoding/otlpencodingextension/go.mod b/extension/encoding/otlpencodingextension/go.mod index 5844cef8d2e8..b154e3ee5a03 100644 --- a/extension/encoding/otlpencodingextension/go.mod +++ b/extension/encoding/otlpencodingextension/go.mod @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/encod go 1.20 require ( + github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding v0.0.0-00010101000000-000000000000 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.88.1-0.20231026220224-6405e152a2d9 go.opentelemetry.io/collector/extension v0.88.1-0.20231026220224-6405e152a2d9 @@ -39,3 +40,5 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding => ../ diff --git a/extension/encoding/textencodingextension/extension.go b/extension/encoding/textencodingextension/extension.go index 42bc16eb82f1..24d65131a2ea 100644 --- a/extension/encoding/textencodingextension/extension.go +++ b/extension/encoding/textencodingextension/extension.go @@ -9,11 +9,14 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/plog" + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/textutils" ) -var _ plog.Marshaler = &textExtension{} -var _ plog.Unmarshaler = &textExtension{} +var ( + _ encoding.LogsMarshalerExtension = (*textExtension)(nil) + _ encoding.LogsUnmarshalerExtension = (*textExtension)(nil) +) type textExtension struct { config *Config diff --git a/extension/encoding/textencodingextension/go.mod b/extension/encoding/textencodingextension/go.mod index 3a29ab7bf355..9aa992301976 100644 --- a/extension/encoding/textencodingextension/go.mod +++ b/extension/encoding/textencodingextension/go.mod @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/encod go 1.20 require ( + github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding v0.0.0-00010101000000-000000000000 github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.88.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.88.1-0.20231026220224-6405e152a2d9 @@ -48,3 +49,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../../pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding => ../ diff --git a/extension/encoding/zipkinencodingextension/config.go b/extension/encoding/zipkinencodingextension/config.go index 30d3ff545bd7..9bd260bd7c91 100644 --- a/extension/encoding/zipkinencodingextension/config.go +++ b/extension/encoding/zipkinencodingextension/config.go @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package zipkinencodingextension // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/zipkinencodingextension" + import ( "fmt" diff --git a/extension/encoding/zipkinencodingextension/extension.go b/extension/encoding/zipkinencodingextension/extension.go index 8f0504659df5..3fcb72ad8046 100644 --- a/extension/encoding/zipkinencodingextension/extension.go +++ b/extension/encoding/zipkinencodingextension/extension.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/ptrace" + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin/zipkinv1" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin/zipkinv2" ) @@ -24,8 +25,8 @@ const ( ) var ( - _ ptrace.Marshaler = (*zipkinExtension)(nil) - _ ptrace.Unmarshaler = (*zipkinExtension)(nil) + _ encoding.TracesMarshalerExtension = (*zipkinExtension)(nil) + _ encoding.TracesUnmarshalerExtension = (*zipkinExtension)(nil) ) type zipkinExtension struct { diff --git a/extension/encoding/zipkinencodingextension/go.mod b/extension/encoding/zipkinencodingextension/go.mod index 1a91f89e0b72..f00ecda41afd 100644 --- a/extension/encoding/zipkinencodingextension/go.mod +++ b/extension/encoding/zipkinencodingextension/go.mod @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/encod go 1.20 require ( + github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding v0.0.0-00010101000000-000000000000 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.88.0 go.opentelemetry.io/collector/component v0.88.1-0.20231026220224-6405e152a2d9 go.opentelemetry.io/collector/extension v0.88.1-0.20231026220224-6405e152a2d9 @@ -55,3 +56,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../../pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding => ../ diff --git a/versions.yaml b/versions.yaml index 98a60c22610d..c919bd6a1686 100644 --- a/versions.yaml +++ b/versions.yaml @@ -70,6 +70,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy - 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 - 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