<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Deprecates `configauth.Authentication` in favor of
`configauth.AuthenticationConfig`.
<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes#12875
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR fixes a test in ARM by using a shorter file name in socket
(rolling back the behavior introduced in #12576 ). Seems that we ran
into an issue similar to https://github.com/golang/go/issues/6895
<!-- Issue number if applicable -->
#### Link to tracking issue
n/a
<!--Describe what testing was performed and which tests were added.-->
#### Testing
n/a
<!--Describe the documentation added.-->
#### Documentation
n/a
<!--Please delete paragraphs that you did not use before submitting.-->
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
An attempt at splitting `extensionauth.Client` by protocol type.
open-telemetry/opentelemetry-collector-contrib/pull/38451 removes usages
of the `NewClient` and `NewServer` constructor
---------
Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com>
#### Description
There are a bunch of warnings in the lint output about tenv being
deprecated, and moving to usetesting. Reference:
https://golangci-lint.run/usage/linters/#tenv
#### Link to tracking issue
none
#### Testing
Ran `make golint` and `make all`
<!--Describe the documentation added.-->
---------
Co-authored-by: Pablo Baeyens <pablo.baeyens@datadoghq.com>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Removes `extensionauthtest.MockClient`. Users can use either
`extensionauth.NewClient` or use `extensionauthtest.NewErrorClient` as a
convenience method to replicate the `MustError` field behavior.
Doing a Github search, I am unable to find usages of this outside of
contrib, which I dealt with on PR
open-telemetry/opentelemetry-collector-contrib/pull/38401, thus I
believe this should be fine to remove in one go.
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Adds errors in return type to `extensionauth.New*` functions. This is
not a breaking change since `extensionauth` is an unreleased module.
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
- Deprecates `extension/auth` in favor of `extension/extensionauth`.
- Deprecates `extension/auth/authtest` in favor of
`extension/auth/authtest`
#### Description
This PR uses the `grpc.WithUnaryInterceptor` option to add the metadata
configured in `ClientConfig.Headers` automatically to requests made with
the created `grpc.ClientConn`. Currently, users of `configgrpc` must
extract the headers from the config and insert them manually in each
request.
The current implementation is meant to be backward-compatible with code
that manually inserts the headers: if a header key is already present in
the `Context` passed to the interceptor, it will not be modified and no
duplicate will be added.
#### Link to tracking issue
Fixes#12307
#### Testing
The tests in `otlpexporter` check that headers are properly inserted,
and they still pass after removing the OTLP-specific headers code. I
also added a new test in configgrpc for testing unary RPC calls.
I'm not sure how to easily test streaming RPC calls however (hence the
lacking code coverage), but since [the
docs](https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md)
imply that adding metadata to streaming RPC calls is the same as unary
calls, it should hopefully work.
#### Context
The `configauth.NewDefaultAuthentication` returns a zero-initialized
`Authentication` value
([link](477e4d3959/config/configauth/configauth.go (L25))),
which is used in `configgrpc.NewDefaultClientConfig`
([link](477e4d3959/config/configgrpc/configgrpc.go (L109)))
and `configgrpc.NewDefaultServerConfig`
([link](477e4d3959/config/configgrpc/configgrpc.go (L196))).
However, this default value is problematic, as it will cause the
Collector to crash on startup with the error `Error: cannot start
pipelines: failed to resolve authenticator "": authenticator not found`.
There is no way for the `Authentication` struct to represent "no
authentication" (which is presumably the intended default). The
`configgrpc` code uses a `nil` `*Authentication` pointer to represent
that case
([link](477e4d3959/config/configgrpc/configgrpc.go (L310))).
Regarding the use of these APIs:
- Across Github, it looks like `configauth.NewDefaultAuthentication` is
not used outside of `configgrpc`.
- I haven't found any use of `configgrpc.NewDefaultServerConfig` on
Github, and `configgrpc.NewDefaultClientConfig` has [one use in the
Elastic OTel components
repo](3cfc4ac3a5/processor/ratelimitprocessor/config.go (L164)),
although I suspect the `Auth` field may get overriden anyway, so the
crash may never actually occur.
- It looks like the gRPC receivers/exporters in Core build their default
`ClientConfig`/`ServerConfig` manually instead of using those functions,
leaving the `Auth` field `nil`, which is why the crash does not occur
there either.
#### Description
This PR:
- Removes `configauth.NewDefaultAuthentication` since there doesn't seem
to be a useful "default" value for this struct. Because it doesn't seem
to be used outside this repo, I decided to skip the deprecation step.
- Replaces its use in
`configgrpc.NewDefaultClient/NewDefaultServerConfig` by `nil`. I think
this would be considered a bug fix rather than a breaking change, since
the current value causes an error if not overriden.
#### Link to tracking issue
Resolves#12223 (the original issue was about making the function
signature more consistent, but removing the function entirely makes it
no longer an issue I would say)
#### Testing
I experimentally confirmed that the above crash occurs with default
config if we change the OTLP receiver's `createDefaultConfig` to use
`configgrpc.NewDefaultServerConfig`, and that the above fix to said
function prevents the crash.
#### Description
[gofumpt](https://golangci-lint.run/usage/linters/#gofumpt) is a
stricter format than gofmt, while being backwards compatible.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
#### Description
[whitespace](https://golangci-lint.run/usage/linters/#whitespace) is a
linter that checks for unnecessary newlines at the start and end of
functions.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
#### Description
To allow extending the possible option types provided to
`configgrpc.ClientConfig.ToClientConn` and
`configgrpc.ServerConfig.ToServer` in the future, we want to wrap the
`grpc.DialOption` and `grpc.ServerOption` parameters in more generic
`ToClientConnOption` and `ToServerOption` interfaces.
For compatibility, we start by adding new `ToClientConnWithOptions` and
`ToServerWithOptions` methods, to which the now deprecated
`ToClientConn` and `ToServer` defer. A second PR will be needed to fully
replace the original methods.
#### Link to tracking issue
Fixes#9480
#### Testing
No tests have been added. Feel free to tell me if I should add some.
#### Documentation
No documentation has been added.
---------
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Change the value of max_recv_msg_size_mib from uint64 to int to avoid a
case where misconfiguration caused an integer overflow. Added a Validate
function to configgrpc as part of this to validate that users didn't set
the value to something that would overflow when converted from megabytes
to bytes.
---------
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
#### Description
Updates the default `pick_first` load balancer to `round_robin`, which
allows for better resource allocation and less chances of throttling
data being sent to addresses.
#### Link to tracking issue
Fixes#10298 (has full context of this PR)
#### Testing
Edited tests to allow round_robin load balancing.
---------
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Juraci Paixão Kröhling <juraci.github@kroehling.de>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
<!-- Issue number if applicable -->
Promotes `component.UseLocalHostAsDefaultHost` feature gate to beta.
#### Link to tracking issue
Updates #8510
Added context.Context to the following functions:
- GetClientAuthenticator
- GetServerAuthenticator
Link to the issue:
https://github.com/open-telemetry/opentelemetry-collector/issues/9808
---------
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Description:
Added newDefault methods for structs in configgrpc package
Closes https://github.com/open-telemetry/opentelemetry-collector/issues/9654
Testing: Tests were added for the NewDefault functions
---------
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
**Description:**
Removes deprecated `ToServer`.
Deprecate `ToServerContext`
Add new `ToServer` with `context.Context`.
**Link to tracking Issue:** Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/9490
---------
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
**Description:**
Changes `Transport` from a `string` to a new `TransportType`. Implements
`UnmarshalText` for `TransportType` to enforce values.
This PR may be too much - it introduces a breaking change a lot of new
public APIs that may not be worth it for such a small module. If we
don't like the surface area this creates or the breaking change, but we
still want to enforce transport type values, I think implementing
`Validate` keeps the API footprint smaller and isn't breaking.
**Link to tracking Issue:** <Issue number if applicable>
Closes
https://github.com/open-telemetry/opentelemetry-collector/issues/9364
**Documentation:** <Describe the documentation added.>
Added godoc comments
---------
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
Adds a new function, `ToServerContext` which does what `ToServer` does,
but takes a `context.Context`. After the next release we'll deprecate
`ToServerContext` and rename it to `ToServer`.
Related to
https://github.com/open-telemetry/opentelemetry-collector/issues/9490
---------
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
**Description:**
Simply renames a few structs in the `configtls` package for consistence.
`TLSClientSetting` to `ClientConfig`
`TLSServerSetting` to `ServerConfig`
`TLSSetting` to `Config`
**Link to tracking Issue:** Fixes#9474
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Enables goleak to run on the configgrpc package. Requires ignoring the
opencensus-go leak.
A few tests required an additional client connection close command to
exit the client go routine. Additional information can be found
[here](https://pkg.go.dev/google.golang.org/grpc#DialContext) in the
explanation for the method grpc.DialContext, specifically this comment:
```
Users should call ClientConn.Close to terminate all the pending operations after this function returns.
```
configgrpc's method
[`ToClientConn`](36730599ae/config/configgrpc/configgrpc.go (L178))
is directly calling the `grpc.DialContext` method referenced.
**Link to tracking Issue:** <Issue number if applicable>
#9165
**Testing:** <Describe what testing was performed and which tests were
added.>
Added goleak check is passing
**Description:**
- Adds `component.MustNewType` to create a type. This function panics if
the type has invalid characters. Add similar functions
`component.MustNewID` and `component.MustNewIDWithName`.
- Adds `component.Type.String` to recover the string
- Use `component.MustNewType`, `component.MustNewID`,
`component.MustNewIDWithName` and `component.Type.String` everywhere in
this codebase. To do this I changed `component.Type` into an opaque
struct and checked for compile-time errors.
Some notes:
1. All components currently on core and contrib follow this rule. This
is still breaking for other components.
2. A future PR will change this into a struct, to actually validate this
(right now you can just do `component.Type("anything")` to bypass
validation). I want to do this in two steps to avoid breaking contrib
tests: we first introduce this function, and after that we change into a
struct.
**Link to tracking Issue:** Updates #9208
Bump
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
from 0.45.0 to 0.46.0 in /cmd/otelcorecol
Bump
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
from 0.45.0 to 0.46.0 in /config/configgrpc
Bump
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
from 0.45.0 to 0.46.0 in /exporter/otlpexporter
Bump
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
from 0.45.0 to 0.46.0 in /exporter/otlphttpexporter
Bump
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
from 0.45.0 to 0.46.0 in /receiver/otlpreceiver
---------
Signed-off-by: Alex Boten <aboten@lightstep.com>
Co-authored-by: Alex Boten <aboten@lightstep.com>
gRPC-Go's `balancer` package includes a static
registration mechanism and a way to inspect whether a balancer name is
registered. We should use this mechanism instead of hard-coding an
allowlist of balancer names.
Custom collector configurations may have additional balancers linked in,
and we should allow them to be used.
* [chore] use license shortform
To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052
Signed-off-by: Alex Boten <aboten@lightstep.com>
* make goporto
Signed-off-by: Alex Boten <aboten@lightstep.com>
---------
Signed-off-by: Alex Boten <aboten@lightstep.com>