Skip to content

Commit f821db7

Browse files
damemicrobert-1
andauthored
[extension/googleclientauth] Add new component boilerplate scaffolding (#31518)
**Description:** This adds the basic component boilerplate following the recommendations for PR1 in https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#adding-new-components **Link to tracking Issue:** #31412 **Testing:** Ran various `make ...` commands as listed in docs. Ignored generated files and failures from unrelated components. **Documentation:** New readme and metadata (to be filled in, see tracking issue) --------- Co-authored-by: Curtis Robert <[email protected]>
1 parent 3c9a357 commit f821db7

File tree

17 files changed

+396
-0
lines changed

17 files changed

+396
-0
lines changed

.chloggen/gcp-auth-ext.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: new_component
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: googleclientauthextension
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Add boilerplate for Google Client Auth Extension
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [31412]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ extension/encoding/jsonlogencodingextension/ @open-telemetry/collect
9292
extension/encoding/otlpencodingextension/ @open-telemetry/collector-contrib-approvers @dao-jun @VihasMakwana
9393
extension/encoding/textencodingextension/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @atoulme
9494
extension/encoding/zipkinencodingextension/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @dao-jun
95+
extension/googleclientauthextension/ @open-telemetry/collector-contrib-approvers @aabmass @dashpole @jsuereth @punya @damemi @psx95
9596
extension/headerssetterextension/ @open-telemetry/collector-contrib-approvers @jpkrohling
9697
extension/healthcheckextension/ @open-telemetry/collector-contrib-approvers @jpkrohling
9798
extension/httpforwarderextension/ @open-telemetry/collector-contrib-approvers @atoulme @rmfitzpatrick

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ body:
9292
- extension/encoding/otlpencoding
9393
- extension/encoding/textencoding
9494
- extension/encoding/zipkinencoding
95+
- extension/googleclientauth
9596
- extension/headerssetter
9697
- extension/healthcheck
9798
- extension/httpforwarder

.github/ISSUE_TEMPLATE/feature_request.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ body:
8686
- extension/encoding/otlpencoding
8787
- extension/encoding/textencoding
8888
- extension/encoding/zipkinencoding
89+
- extension/googleclientauth
8990
- extension/headerssetter
9091
- extension/healthcheck
9192
- extension/httpforwarder

.github/ISSUE_TEMPLATE/other.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ body:
8686
- extension/encoding/otlpencoding
8787
- extension/encoding/textencoding
8888
- extension/encoding/zipkinencoding
89+
- extension/googleclientauth
8990
- extension/headerssetter
9091
- extension/healthcheck
9192
- extension/httpforwarder
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ../../Makefile.Common
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Google Client Auth Extension
2+
<!-- status autogenerated section -->
3+
| Status | |
4+
| ------------- |-----------|
5+
| Stability | [development] |
6+
| Distributions | [] |
7+
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fgoogleclientauth%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fgoogleclientauth) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fgoogleclientauth%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fgoogleclientauth) |
8+
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dashpole](https://www.github.com/dashpole), [@damemi](https://www.github.com/damemi), [@aabmass](https://www.github.com/aabmass), [@jsuereth](https://www.github.com/jsuereth), [@punya](https://www.github.com/punya), [@psx95](https://www.github.com/psx95) |
9+
10+
[development]: https://github.com/open-telemetry/opentelemetry-collector#development
11+
<!-- end autogenerated section -->
12+
13+
This extension provides Google OAuth2 Client Credentials and Metadata for gRPC and http based exporters.
14+
15+
## Configuration
16+
17+
```yaml
18+
extensions:
19+
googleclientauth:
20+
21+
receivers:
22+
otlp:
23+
protocols:
24+
grpc:
25+
26+
exporters:
27+
otlp/withauth:
28+
endpoint: 0.0.0.0:5000
29+
ca_file: /tmp/certs/ca.pem
30+
auth:
31+
authenticator: googleclientauth
32+
33+
service:
34+
extensions: [googleclientauth]
35+
pipelines:
36+
metrics:
37+
receivers: [otlp]
38+
processors: []
39+
exporters: [otlp/withauth]
40+
```
41+
42+
The following optional config fields are available:
43+
- `project` - The Google Cloud Project telemetry is sent to if the `gcp.project.id` resource attribute is not set. If unspecified, this is determined using application default credentials.
44+
- `scopes` - The oauth 2.0 [scopes](https://datatracker.ietf.org/doc/html/rfc6749#section-3.3) requested by the extension.
45+
- `quota_project` - The [project](https://cloud.google.com/apis/docs/system-parameters) for quota and billing purposes. The caller must have `serviceusage.services.use` permission on the project.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package googleclientauthextension // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/googleclientauthextension"
5+
6+
// Config defines configuration for the Google client auth extension.
7+
type Config struct {
8+
}
9+
10+
func (cfg *Config) Validate() error {
11+
return nil
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//go:generate mdatagen metadata.yaml
5+
6+
// Package googleclientauthextension implements an extension that provides authentication with Google Cloud.
7+
package googleclientauthextension // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/googleclientauthextension"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//go:generate mdatagen metadata.yaml
5+
6+
package googleclientauthextension // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/googleclientauthextension"
7+
8+
import (
9+
"context"
10+
11+
"go.opentelemetry.io/collector/component"
12+
"go.opentelemetry.io/collector/extension"
13+
"go.opentelemetry.io/collector/extension/auth"
14+
15+
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/googleclientauthextension/internal/metadata"
16+
)
17+
18+
func NewFactory() extension.Factory {
19+
return extension.NewFactory(
20+
metadata.Type,
21+
func() component.Config { return &Config{} },
22+
func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) {
23+
return auth.NewClient(), nil
24+
},
25+
metadata.ExtensionStability,
26+
)
27+
}

extension/googleclientauthextension/generated_component_test.go

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
module github.com/open-telemetry/opentelemetry-collector-contrib/extension/googleclientauthextension
2+
3+
go 1.21
4+
5+
exclude github.com/knadh/koanf v1.5.0
6+
7+
require (
8+
github.com/stretchr/testify v1.9.0
9+
go.opentelemetry.io/collector/component v0.96.1-0.20240306115632-b2693620eff6
10+
go.opentelemetry.io/collector/confmap v0.96.1-0.20240306115632-b2693620eff6
11+
go.opentelemetry.io/collector/extension v0.96.1-0.20240306115632-b2693620eff6
12+
go.opentelemetry.io/collector/extension/auth v0.96.1-0.20240306115632-b2693620eff6
13+
go.opentelemetry.io/otel/metric v1.24.0
14+
go.opentelemetry.io/otel/trace v1.24.0
15+
go.uber.org/goleak v1.3.0
16+
)
17+
18+
require (
19+
github.com/beorn7/perks v1.0.1 // indirect
20+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
21+
github.com/davecgh/go-spew v1.1.1 // indirect
22+
github.com/go-logr/logr v1.4.1 // indirect
23+
github.com/go-logr/stdr v1.2.2 // indirect
24+
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect
25+
github.com/gogo/protobuf v1.3.2 // indirect
26+
github.com/golang/protobuf v1.5.3 // indirect
27+
github.com/knadh/koanf/maps v0.1.1 // indirect
28+
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect
29+
github.com/knadh/koanf/v2 v2.1.0 // indirect
30+
github.com/mitchellh/copystructure v1.2.0 // indirect
31+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
32+
github.com/pmezard/go-difflib v1.0.0 // indirect
33+
github.com/prometheus/client_golang v1.19.0 // indirect
34+
github.com/prometheus/client_model v0.6.0 // indirect
35+
github.com/prometheus/common v0.48.0 // indirect
36+
github.com/prometheus/procfs v0.12.0 // indirect
37+
go.opentelemetry.io/collector/config/configtelemetry v0.96.1-0.20240306115632-b2693620eff6 // indirect
38+
go.opentelemetry.io/collector/pdata v1.3.1-0.20240306115632-b2693620eff6 // indirect
39+
go.opentelemetry.io/otel v1.24.0 // indirect
40+
go.opentelemetry.io/otel/exporters/prometheus v0.46.0 // indirect
41+
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
42+
go.opentelemetry.io/otel/sdk/metric v1.24.0 // indirect
43+
go.uber.org/multierr v1.11.0 // indirect
44+
go.uber.org/zap v1.27.0 // indirect
45+
golang.org/x/net v0.20.0 // indirect
46+
golang.org/x/sys v0.17.0 // indirect
47+
golang.org/x/text v0.14.0 // indirect
48+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
49+
google.golang.org/grpc v1.62.1 // indirect
50+
google.golang.org/protobuf v1.33.0 // indirect
51+
gopkg.in/yaml.v3 v3.0.1 // indirect
52+
)

0 commit comments

Comments
 (0)