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

Temporarily remove expiration from OTEL exporter #1046

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 0 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,6 @@ require (
sigs.k8s.io/e2e-framework v0.3.0
)

replace go.opentelemetry.io/otel => github.com/grafana/opentelemetry-go v1.28.0-grafana.2

replace go.opentelemetry.io/otel/metric => github.com/grafana/opentelemetry-go/metric v1.28.0-grafana.2

replace go.opentelemetry.io/otel/trace => github.com/grafana/opentelemetry-go/trace v1.28.0-grafana.2

replace go.opentelemetry.io/otel/sdk => github.com/grafana/opentelemetry-go/sdk v1.28.0-grafana.2

replace go.opentelemetry.io/otel/sdk/metric => github.com/grafana/opentelemetry-go/sdk/metric v1.28.0-grafana.2

require (
cloud.google.com/go/compute/metadata v0.4.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.0 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/go-offsets-tracker v0.1.7 h1:2zBQ7iiGzvyXY7LA8kaaSiEqH/Yx82UcfRabbY5aOG4=
github.com/grafana/go-offsets-tracker v0.1.7/go.mod h1:qcQdu7zlUKIFNUdBJlLyNHuJGW0SKWKjkrN6jtt+jds=
github.com/grafana/opentelemetry-go v1.28.0-grafana.2 h1:GmGMrL4hOW9i2djP9kpU2626UJaoao1zbVZGuuC/Tgg=
github.com/grafana/opentelemetry-go v1.28.0-grafana.2/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4=
github.com/grafana/opentelemetry-go/metric v1.28.0-grafana.2 h1:AE5qDMRN0rtX9srQ+Gzuddww23QbVHS/rSATmeV1+CI=
github.com/grafana/opentelemetry-go/metric v1.28.0-grafana.2/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s=
github.com/grafana/opentelemetry-go/sdk v1.28.0-grafana.2 h1:1v9geetSasMpacuJ8RuQXAAKSuh0aJkBrwK3u/Yppe8=
github.com/grafana/opentelemetry-go/sdk v1.28.0-grafana.2/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg=
github.com/grafana/opentelemetry-go/sdk/metric v1.28.0-grafana.2 h1:3Ct2TlVvGdra2vkMoqmeDA0vltaV7nLEWrm7QMDOs4Q=
github.com/grafana/opentelemetry-go/sdk/metric v1.28.0-grafana.2/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg=
github.com/grafana/opentelemetry-go/trace v1.28.0-grafana.2 h1:8fKddaX8cHH5bFt4xQXMVZsg3IfLZyRmJRPrbVhUHt4=
github.com/grafana/opentelemetry-go/trace v1.28.0-grafana.2/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
Expand Down Expand Up @@ -313,6 +303,8 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.5
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0/go.mod h1:BMsdeOxN04K0L5FNUBfjFdvwWGNe/rkmSwH4Aelu/X0=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0=
go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo=
go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 h1:U2guen0GhqH8o/G2un8f/aG/y++OuW6MyCo6hT9prXk=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0/go.mod h1:yeGZANgEcpdx/WK0IvvRFC+2oLiMS2u4L/0Rj2M2Qr0=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 h1:aLmmtjRke7LPDQ3lvpFz+kNEH43faFhzW7v8BFIEydg=
Expand All @@ -329,6 +321,14 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 h1:/jlt1Y8gXWiHG9
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0/go.mod h1:bmToOGOBZ4hA9ghphIc1PAf66VA8KOtsuy3+ScStG20=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 h1:/0YaXu3755A/cFbtXp+21lkXgI0QE5avTWA2HjU9/WE=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0/go.mod h1:m7SFxp0/7IxmJPLIY3JhOcU9CoFzDaCPL6xxQIxhA+o=
go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q=
go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s=
go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE=
go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg=
go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08=
go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg=
go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g=
go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI=
go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
Expand Down
16 changes: 9 additions & 7 deletions pkg/export/otel/expirer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"

"github.com/grafana/beyla/pkg/export/attributes"
"github.com/grafana/beyla/pkg/export/expire"
Expand All @@ -20,7 +19,8 @@ func plog() *slog.Logger {
}

type removableMetric[VT any] interface {
Remove(context.Context, ...metric.RemoveOption)
// TODO [expiration]: uncomment when remove is added to the Otel SDK API
// Remove(context.Context, ...metric.RemoveOption)
}

// Expirer drops metrics from labels that haven't been updated during a given timeout.
Expand Down Expand Up @@ -110,13 +110,15 @@ func (ex *Expirer[Record, Metric, ValType]) removeOutdated(ctx context.Context)
}
}

func (ex *Expirer[Record, Metric, ValType]) deleteMetricInstance(ctx context.Context, attrs attribute.Set) {
if ex.log.Enabled(ex.ctx, slog.LevelDebug) {
ex.logger(attrs).Debug("deleting old OTEL metric")
}
ex.metric.Remove(ctx, metric.WithAttributeSet(attrs))
func (ex *Expirer[Record, Metric, ValType]) deleteMetricInstance(_ context.Context, _ attribute.Set) {
// TODO [expiration]: uncomment when remove is added to the Otel SDK API
// if ex.log.Enabled(ex.ctx, slog.LevelDebug) {
// ex.logger(attrs).Debug("deleting old OTEL metric")
// }
// ex.metric.Remove(ctx, metric.WithAttributeSet(attrs))
}

// nolint:unused
func (ex *Expirer[Record, Metric, ValType]) logger(attrs attribute.Set) *slog.Logger {
fmtAttrs := make([]any, 0, attrs.Len()*2)
for it := attrs.Iter(); it.Next(); {
Expand Down
5 changes: 5 additions & 0 deletions pkg/export/otel/expirer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
const timeout = 20 * time.Second

func TestNetMetricsExpiration(t *testing.T) {
t.Skip("[expiration] removed until OTEL SDK provides Remove function")
defer restoreEnvAfterExecution()()
ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
Expand Down Expand Up @@ -130,6 +131,8 @@ func TestNetMetricsExpiration(t *testing.T) {
// (2) by metric set of a given service ID
// this test verifies case 1
func TestAppMetricsExpiration_ByMetricAttrs(t *testing.T) {
t.Skip("[expiration] removed until OTEL SDK provides Remove function")

defer restoreEnvAfterExecution()()
ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
Expand Down Expand Up @@ -244,6 +247,8 @@ func TestAppMetricsExpiration_ByMetricAttrs(t *testing.T) {
// (2) by metric set of a given service ID
// this test verifies case 2
func TestAppMetricsExpiration_BySvcID(t *testing.T) {
t.Skip("[expiration] removed until OTEL SDK provides Remove function")

defer restoreEnvAfterExecution()()
ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
Expand Down
2 changes: 0 additions & 2 deletions vendor/go.opentelemetry.io/otel/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 0 additions & 48 deletions vendor/go.opentelemetry.io/otel/internal/global/instruments.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 0 additions & 37 deletions vendor/go.opentelemetry.io/otel/metric/instrument.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions vendor/go.opentelemetry.io/otel/metric/noop/noop.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading