Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade OpenTelemetry Collector dependency #3858

Merged
merged 4 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ internal API changes are not present.
Main (unreleased)
-----------------

### Breaking changes

- The algorithm for the "hash" action of `otelcol.processor.attributes` has changed.
The change was made in PR [#22831](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22831) of opentelemetry-collector-contrib. (@ptodev)

- `otelcol.exporter.loki` now includes the instrumentation scope in its output. (@ptodev)

- `otelcol.extension.jaeger_remote_sampling` removes the `\` HTTP endpoint. The `/sampling` endpoint is still functional.
The change was made in PR [#18070](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/18070) of opentelemetry-collector-contrib. (@ptodev)

### Features

- The Pyroscope scrape component computes and sends delta profiles automatically when required to reduce bandwidth usage. (@cyriltovena)
Expand All @@ -20,7 +30,6 @@ Main (unreleased)

- Support custom fields in MMDB file for `stage.geoip`. (@akselleirv)


- New Grafana Agent Flow components:

- `discovery.kubelet` collect scrape targets from the Kubelet API. (@gcampbell12)
Expand Down Expand Up @@ -66,6 +75,8 @@ Main (unreleased)

- The Agent Operational dashboard of Grafana Agent mixin now has more descriptive panel titles, Y-axis units

- Update OpenTelemetry Collector dependencies from v0.63.0 to v0.79.0. (@ptodev)

### Bugfixes

- Add signing region to remote.s3 component for use with custom endpoints so that Authorization Headers work correctly when
Expand Down
2 changes: 1 addition & 1 deletion build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@$CONTROLLER_GEN_V

# rfratto/viceroy contains C cross compilers can be used for our Cgo
# dependencies.
FROM rfratto/viceroy:v0.3.0
FROM rfratto/viceroy:v0.4.0

# Install NodeJS LTS. This is needed because the most recent version of NodeJS
# from official Debian packages is v12, and we need LTS version v16.
Expand Down
20 changes: 10 additions & 10 deletions component/otelcol/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/grafana/agent/pkg/util/zapadapter"
"github.com/prometheus/client_golang/prometheus"
otelcomponent "go.opentelemetry.io/collector/component"
otelconfig "go.opentelemetry.io/collector/config"
otelextension "go.opentelemetry.io/collector/extension"
sdkprometheus "go.opentelemetry.io/otel/exporters/prometheus"
"go.opentelemetry.io/otel/sdk/metric"

Expand All @@ -31,15 +31,15 @@ type Arguments interface {

// Convert converts the Arguments into an OpenTelemetry Collector
// authentication extension configuration.
Convert() (otelconfig.Extension, error)
Convert() (otelcomponent.Config, error)

// Extensions returns the set of extensions that the configured component is
// allowed to use.
Extensions() map[otelconfig.ComponentID]otelcomponent.Extension
Extensions() map[otelcomponent.ID]otelextension.Extension

// Exporters returns the set of exporters that are exposed to the configured
// component.
Exporters() map[otelconfig.DataType]map[otelconfig.ComponentID]otelcomponent.Exporter
Exporters() map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component
}

// Exports is a common Exports type for Flow components which expose
Expand All @@ -52,8 +52,8 @@ type Exports struct {

// Handler combines an extension with its ID.
type Handler struct {
ID otelconfig.ComponentID
Extension otelcomponent.Extension
ID otelcomponent.ID
Extension otelextension.Extension
}

var _ river.Capsule = Handler{}
Expand All @@ -68,7 +68,7 @@ type Auth struct {
cancel context.CancelFunc

opts component.Options
factory otelcomponent.ExtensionFactory
factory otelextension.Factory

sched *scheduler.Scheduler
collector *lazycollector.Collector
Expand All @@ -85,7 +85,7 @@ var (
//
// The registered component must be registered to export the Exports type from
// this package, otherwise New will panic.
func New(opts component.Options, f otelcomponent.ExtensionFactory, args Arguments) (*Auth, error) {
func New(opts component.Options, f otelextension.Factory, args Arguments) (*Auth, error) {
ctx, cancel := context.WithCancel(context.Background())

// Create a lazy collector where metrics from the upstream component will be
Expand Down Expand Up @@ -135,7 +135,7 @@ func (a *Auth) Update(args component.Arguments) error {
return err
}

settings := otelcomponent.ExtensionCreateSettings{
settings := otelextension.CreateSettings{
TelemetrySettings: otelcomponent.TelemetrySettings{
Logger: zapadapter.New(a.opts.Logger),

Expand Down Expand Up @@ -168,7 +168,7 @@ func (a *Auth) Update(args component.Arguments) error {
// Inform listeners that our handler changed.
a.opts.OnStateChange(Exports{
Handler: Handler{
ID: otelconfig.NewComponentID(otelconfig.Type(a.opts.ID)),
ID: otelcomponent.NewID(otelcomponent.Type(a.opts.ID)),
Extension: ext,
},
})
Expand Down
21 changes: 10 additions & 11 deletions component/otelcol/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/grafana/agent/pkg/util"
"github.com/stretchr/testify/require"
otelcomponent "go.opentelemetry.io/collector/component"
otelconfig "go.opentelemetry.io/collector/config"
otelextension "go.opentelemetry.io/collector/extension"
)

func TestAuth(t *testing.T) {
Expand Down Expand Up @@ -45,14 +45,14 @@ func newTestEnvironment(t *testing.T, onCreated func()) *testEnvironment {
Args: fakeAuthArgs{},
Exports: otelcol.ConsumerExports{},
Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
factory := otelcomponent.NewExtensionFactory(
factory := otelextension.NewFactory(
"testcomponent",
func() otelconfig.Extension { return nil },
func() otelcomponent.Config { return nil },
func(
_ context.Context,
_ otelcomponent.ExtensionCreateSettings,
_ otelconfig.Extension,
) (otelcomponent.Extension, error) {
_ otelextension.CreateSettings,
_ otelcomponent.Config,
) (otelcomponent.Component, error) {

onCreated()
return nil, nil
Expand Down Expand Up @@ -82,15 +82,14 @@ type fakeAuthArgs struct {

var _ auth.Arguments = fakeAuthArgs{}

func (fa fakeAuthArgs) Convert() (otelconfig.Extension, error) {
settings := otelconfig.NewExtensionSettings(otelconfig.NewComponentID("testcomponent"))
return &settings, nil
func (fa fakeAuthArgs) Convert() (otelcomponent.Config, error) {
return &struct{}{}, nil
}

func (fa fakeAuthArgs) Extensions() map[otelconfig.ComponentID]otelcomponent.Extension {
func (fa fakeAuthArgs) Extensions() map[otelcomponent.ID]otelextension.Extension {
return nil
}

func (fa fakeAuthArgs) Exporters() map[otelconfig.DataType]map[otelconfig.ComponentID]otelcomponent.Exporter {
func (fa fakeAuthArgs) Exporters() map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component {
return nil
}
12 changes: 6 additions & 6 deletions component/otelcol/auth/basic/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"github.com/grafana/agent/pkg/river/rivertypes"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension"
otelcomponent "go.opentelemetry.io/collector/component"
otelconfig "go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configopaque"
otelextension "go.opentelemetry.io/collector/extension"
)

func init() {
Expand All @@ -34,22 +35,21 @@ type Arguments struct {
var _ auth.Arguments = Arguments{}

// Convert implements auth.Arguments.
func (args Arguments) Convert() (otelconfig.Extension, error) {
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &basicauthextension.Config{
ExtensionSettings: otelconfig.NewExtensionSettings(otelconfig.NewComponentID("basic")),
ClientAuth: &basicauthextension.ClientAuthSettings{
Username: args.Username,
Password: string(args.Password),
Password: configopaque.String(args.Password),
},
}, nil
}

// Extensions implements auth.Arguments.
func (args Arguments) Extensions() map[otelconfig.ComponentID]otelcomponent.Extension {
func (args Arguments) Extensions() map[otelcomponent.ID]otelextension.Extension {
return nil
}

// Exporters implements auth.Arguments.
func (args Arguments) Exporters() map[otelconfig.DataType]map[otelconfig.ComponentID]otelcomponent.Exporter {
func (args Arguments) Exporters() map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component {
return nil
}
4 changes: 2 additions & 2 deletions component/otelcol/auth/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/grafana/agent/pkg/util"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config/configauth"
extauth "go.opentelemetry.io/collector/extension/auth"
)

// Test performs a basic integration test which runs the otelcol.auth.basic
Expand Down Expand Up @@ -62,7 +62,7 @@ func Test(t *testing.T) {
exports := ctrl.Exports().(auth.Exports)
require.NotNil(t, exports.Handler.Extension, "handler extension is nil")

clientAuth, ok := exports.Handler.Extension.(configauth.ClientAuthenticator)
clientAuth, ok := exports.Handler.Extension.(extauth.Client)
require.True(t, ok, "handler does not implement configauth.ClientAuthenticator")

rt, err := clientAuth.RoundTripper(http.DefaultTransport)
Expand Down
34 changes: 27 additions & 7 deletions component/otelcol/auth/bearer/bearer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"github.com/grafana/agent/pkg/river/rivertypes"
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension"
otelcomponent "go.opentelemetry.io/collector/component"
otelconfig "go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configopaque"
otelextension "go.opentelemetry.io/collector/extension"
)

func init() {
Expand All @@ -25,25 +26,44 @@ func init() {

// Arguments configures the otelcol.auth.bearer component.
type Arguments struct {
Token rivertypes.Secret `river:"token,attr"`
// Do not include the "filename" attribute - users should use local.file instead.
Scheme string `river:"scheme,attr,optional"`
Token rivertypes.Secret `river:"token,attr"`
}

var _ auth.Arguments = Arguments{}

// DefaultArguments holds default settings for Arguments.
var DefaultArguments = Arguments{
Scheme: "Bearer",
}

// UnmarshalRiver implements river.Unmarshaler.
func (args *Arguments) UnmarshalRiver(f func(interface{}) error) error {
*args = DefaultArguments

type arguments Arguments
if err := f((*arguments)(args)); err != nil {
return err
}

return nil
}

// Convert implements auth.Arguments.
func (args Arguments) Convert() (otelconfig.Extension, error) {
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &bearertokenauthextension.Config{
ExtensionSettings: otelconfig.NewExtensionSettings(otelconfig.NewComponentID("bearer")),
BearerToken: string(args.Token),
Scheme: args.Scheme,
BearerToken: configopaque.String(args.Token),
}, nil
}

// Extensions implements auth.Arguments.
func (args Arguments) Extensions() map[otelconfig.ComponentID]otelcomponent.Extension {
func (args Arguments) Extensions() map[otelcomponent.ID]otelextension.Extension {
return nil
}

// Exporters implements auth.Arguments.
func (args Arguments) Exporters() map[otelconfig.DataType]map[otelconfig.ComponentID]otelcomponent.Exporter {
func (args Arguments) Exporters() map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component {
return nil
}
Loading