forked from open-telemetry/opentelemetry-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: custom changes in configgrpc, confighttp and service
- Loading branch information
1 parent
7218b4c
commit 9af37d4
Showing
7 changed files
with
116 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# How this fork works | ||
|
||
This fork was created to be able to early patch open-telemetry/opentelemetry-collector versions in cases it is hard to get the change in upstream right away. | ||
|
||
## How do we consume this library | ||
|
||
For every opentelemetry-collector release we create a new release including our own patches. For example for version v0.49.0 we in open-telemetry/opentelemetry-collector we will crease v0.49.0+patches. This make sure we stick to a version in our downstream dependencies. | ||
|
||
Whenever we need a new release on this repository we rebase the branch `latest+patches` version against the new release for open-telemetry/opentelemetry-collector and then get a new release. For example on version `v0.49.0` (asuming `origin` is `[email protected]:hypertrace/opentelemetry-collector.git` and `upstream` is `[email protected]:open-telemetry/opentelemetry-collector.git`): | ||
|
||
```bash | ||
git fetch --all | ||
git checkout latest+patches | ||
git pull --rebase upstream refs/tags/v0.49.0 | ||
# make lint test | ||
git tag -a "v0.49.0+patches" -m "Release v0.49.0" | ||
git push --tags | ||
``` | ||
|
||
## What custom changes are in here | ||
- In `config/configgrpc/configgrpc.go` we added the ability to add extra `ClientDialOptionHandler`. Also a unit test for this in `config/configgrpc/configgrpcclientdialoptionhandler_test.go`. Also commented out warning on servers starting `UnspecifiedHost` aka `0.0.0.0`. | ||
- In `config/configgrpc/configgrpc_test.go` we commented a unit test checking for a warning on servers starting `UnspecifiedHost` aka `0.0.0.0`. | ||
- In `config/confighttp/confighttp.go` we commented out warning on servers starting `UnspecifiedHost`. | ||
- In ` config/confighttp/confighttp_test.go` we commented a unit test checking for a warning on servers starting `UnspecifiedHost`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
config/configgrpc/configgrpcclientdialoptionhandler_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// This is a test added by us. | ||
package configgrpc | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"google.golang.org/grpc" | ||
|
||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/component/componenttest" | ||
"go.opentelemetry.io/collector/extension" | ||
) | ||
|
||
func TestRegisterClientDialOptionHandler(t *testing.T) { | ||
tt, err := componenttest.SetupTelemetry(component.MustNewID("component")) | ||
require.NoError(t, err) | ||
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) | ||
|
||
gcs := &ClientConfig{} | ||
opts, err := gcs.toDialOptions( | ||
&mockHost{ext: map[component.ID]extension.Extension{}}, | ||
tt.TelemetrySettings(), | ||
) | ||
require.NoError(t, err) | ||
|
||
defaultOptsLen := len(opts) | ||
|
||
RegisterClientDialOptionHandlers(func() grpc.DialOption { | ||
return grpc.WithUnaryInterceptor(func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { | ||
return invoker(ctx, method, req, reply, cc, opts...) | ||
}) | ||
}) | ||
gcs = &ClientConfig{} | ||
opts, err = gcs.toDialOptions( | ||
&mockHost{ext: map[component.ID]extension.Extension{}}, | ||
tt.TelemetrySettings(), | ||
) | ||
assert.NoError(t, err) | ||
assert.Len(t, opts, defaultOptsLen+1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters