Skip to content

Commit 990e881

Browse files
authored
feat: add basicauth extension (#1584)
This adds the [basicauth](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/basicauthextension) extension from the contrib repository. Basic auth is IMHO common enough to warrant inclusion in the default build of this extension. Signed-off-by: Dominik Süß <[email protected]>
1 parent 43d45e4 commit 990e881

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

collector/go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ require (
3939
)
4040

4141
require (
42+
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect
4243
github.com/alecthomas/participle/v2 v2.1.1 // indirect
4344
github.com/antchfx/xmlquery v1.4.2 // indirect
4445
github.com/antchfx/xpath v1.3.2 // indirect
@@ -105,6 +106,7 @@ require (
105106
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
106107
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.112.0 // indirect
107108
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.112.0 // indirect
109+
github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension v0.112.0 // indirect
108110
github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.112.0 // indirect
109111
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.112.0 // indirect
110112
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.112.0 // indirect
@@ -135,6 +137,7 @@ require (
135137
github.com/shirou/gopsutil/v4 v4.24.9 // indirect
136138
github.com/spf13/cobra v1.8.1 // indirect
137139
github.com/spf13/pflag v1.0.5 // indirect
140+
github.com/tg123/go-htpasswd v1.2.2 // indirect
138141
github.com/tidwall/gjson v1.10.2 // indirect
139142
github.com/tidwall/match v1.1.1 // indirect
140143
github.com/tidwall/pretty v1.2.0 // indirect
@@ -215,6 +218,7 @@ require (
215218
go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect
216219
go.opentelemetry.io/otel/trace v1.31.0 // indirect
217220
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
221+
golang.org/x/crypto v0.28.0 // indirect
218222
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
219223
golang.org/x/net v0.30.0 // indirect
220224
golang.org/x/sys v0.26.0 // indirect

collector/go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 h1:KeNholpO2xKjgaaSyd+DyQRrsQjhbSeS7qe4nEw8aQw=
2+
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962/go.mod h1:kC29dT1vFpj7py2OvG1khBdQpo3kInWP+6QipLbdngo=
13
github.com/alecthomas/assert/v2 v2.3.0 h1:mAsH2wmvjsuvyBvAmCtm7zFsBlb8mIHx5ySLVdDZXL0=
24
github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ=
35
github.com/alecthomas/participle/v2 v2.1.1 h1:hrjKESvSqGHzRb4yW1ciisFJ4p3MGYih6icjJvbsmV8=
@@ -162,6 +164,8 @@ github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsc
162164
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.112.0/go.mod h1:40iIKGzEHeNlNAbq3kUE8C/bOebNp5IHpQPvFNhD1J8=
163165
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.112.0 h1:wVrvklcUupqv6QbJem6FzU5WsRT6vBRZ44H8+5mbDZY=
164166
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.112.0/go.mod h1:2NLuedaWMvqnchUtg3rurA0l/xBUmcq2UtEmXwObndw=
167+
github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension v0.112.0 h1:RY0/7LTffj76403QxSlEjb0gnF788Qyfpxc+y32Rd6c=
168+
github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension v0.112.0/go.mod h1:1Z84oB3hwUH1B3IsL46csEtu7WA1qQJ/p6USTulGJf4=
165169
github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.112.0 h1:XYTTlyT5xjZKcUaQT05ffltMahw2S2wU7qIWtjLp7XE=
166170
github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.112.0/go.mod h1:wlnJiEwFYq3920DXOgDby5w6ctv57GJUTkvH4gHoBVA=
167171
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.112.0 h1:PVgAm7sIQUOS8TtX5ANV+hHn67vW6cW6uVy3qifccKc=
@@ -228,6 +232,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
228232
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
229233
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
230234
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
235+
github.com/tg123/go-htpasswd v1.2.2 h1:tmNccDsQ+wYsoRfiONzIhDm5OkVHQzN3w4FOBAlN6BY=
236+
github.com/tg123/go-htpasswd v1.2.2/go.mod h1:FcIrK0J+6zptgVwK1JDlqyajW/1B4PtuJ/FLWl7nx8A=
231237
github.com/tidwall/gjson v1.10.2 h1:APbLGOM0rrEkd8WBw9C24nllro4ajFuJu0Sc9hRz8Bo=
232238
github.com/tidwall/gjson v1.10.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
233239
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
@@ -423,6 +429,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
423429
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
424430
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
425431
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
432+
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
433+
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
426434
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
427435
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
428436
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=

collector/lambdacomponents/default.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package lambdacomponents
1818

1919
import (
2020
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter"
21+
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension"
2122
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension"
2223
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor"
2324
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor"
@@ -80,6 +81,7 @@ func Components(extensionID string) (otelcol.Factories, error) {
8081

8182
extensions, err := extension.MakeFactoryMap(
8283
sigv4authextension.NewFactory(),
84+
basicauthextension.NewFactory(),
8385
)
8486
if err != nil {
8587
errs = append(errs, err)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//go:build lambdacomponents.custom && (lambdacomponents.all || lambdacomponents.extension.all || lambdacomponents.extension.basicauth)
2+
3+
// Copyright The OpenTelemetry Authors
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
package extension
18+
19+
import (
20+
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension"
21+
"go.opentelemetry.io/collector/extension"
22+
)
23+
24+
func init() {
25+
Factories = append(Factories, func(extensionId string) extension.Factory {
26+
return basicauthextension.NewFactory()
27+
})
28+
}

0 commit comments

Comments
 (0)