Skip to content
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
14 changes: 12 additions & 2 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"errors"
"fmt"
"log/slog"
"math/rand/v2"
"time"

arrowpb "github.com/open-telemetry/otel-arrow/api/experimental/arrow/v1"
"github.com/open-telemetry/otel-arrow/pkg/otel/arrow_record"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/ebpf-profiler/libpf"
)

type Producer interface {
Expand Down Expand Up @@ -139,7 +139,17 @@ func (e *Exporter) Start(ctx context.Context) error {
if err := e.report(ctx); err != nil {
return fmt.Errorf("failed to send arrow metrics: %v", err)
}
tick.Reset(libpf.AddJitter(e.interval, 0.2))
tick.Reset(addJitter(e.interval, 0.2))
}
}
}

// addJitter adds +/- jitter (jitter is [0..1]) to baseDuration
// originally copied from go.opentelemetry.io/epbf-profiler
func addJitter(baseDuration time.Duration, jitter float64) time.Duration {
if jitter < 0.0 || jitter > 1.0 {
return baseDuration
}
//nolint:gosec
return time.Duration((1 + jitter - 2*jitter*rand.Float64()) * float64(baseDuration))
}
24 changes: 21 additions & 3 deletions flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/alecthomas/kong"
parcaflags "github.com/parca-dev/parca-agent/flags"
)

type ExitCode int
Expand All @@ -32,8 +31,27 @@ type Flags struct {
ClockSyncInterval time.Duration `default:"3m" help:"How frequently to synchronize with the realtime clock."`

// which metrics producers (e.g. nvidia) to enable
MetricsProducer FlagsMetricProducer `embed:"" prefix:"metrics-producer-"`
RemoteStore parcaflags.FlagsRemoteStore `embed:"" prefix:"remote-store-"`
MetricsProducer FlagsMetricProducer `embed:"" prefix:"metrics-producer-"`
RemoteStore FlagsRemoteStore `embed:"" prefix:"remote-store-"`
}

// FlagsRemoteStore provides remote store configuration flags.
type FlagsRemoteStore struct {
Address string `help:"gRPC address to send profiles and symbols to."`
BearerToken string `kong:"help='Bearer token to authenticate with store.',env='PARCA_BEARER_TOKEN'"`
BearerTokenFile string `help:"File to read bearer token from to authenticate with store."`
Insecure bool `help:"Send gRPC requests via plaintext instead of TLS."`
InsecureSkipVerify bool `help:"Skip TLS certificate verification."`

BatchWriteInterval time.Duration `default:"10s" help:"[deprecated] Interval between batch remote client writes. Leave this empty to use the default value of 10s."`
RPCLoggingEnable bool `default:"false" help:"[deprecated] Enable gRPC logging."`
RPCUnaryTimeout time.Duration `default:"5m" help:"[deprecated] Maximum timeout window for unary gRPC requests including retries."`

GRPCMaxCallRecvMsgSize int `default:"33554432" help:"The maximum message size the client can receive."`
GRPCMaxCallSendMsgSize int `default:"33554432" help:"The maximum message size the client can send."`
GRPCStartupBackoffTime time.Duration `default:"1m" help:"The time between failed gRPC requests during startup phase."`
GRPCConnectionTimeout time.Duration `default:"3s" help:"The timeout duration for gRPC connection establishment."`
GRPCMaxConnectionRetries uint32 `default:"5" help:"The maximum number of retries to establish a gRPC connection."`
}

// FlagsLocalStore provides logging configuration flags.
Expand Down
63 changes: 26 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,63 @@ module github.com/polarsignals/gpu-metrics-agent
go 1.23.2

require (
github.com/NVIDIA/go-nvml v0.12.4-0
github.com/alecthomas/kong v1.5.1
github.com/NVIDIA/go-nvml v0.12.4-1
github.com/alecthomas/kong v1.9.0
github.com/gogo/protobuf v1.3.2
github.com/google/uuid v1.6.0
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0
github.com/oklog/run v1.1.0
github.com/open-telemetry/otel-arrow v0.31.0
github.com/parca-dev/parca-agent v0.35.0
github.com/prometheus/client_golang v1.20.5
go.opentelemetry.io/collector/pdata v1.21.0
go.opentelemetry.io/ebpf-profiler v0.0.0-20241206162831-84cce0a2aff6
go.opentelemetry.io/otel/trace v1.32.0
github.com/open-telemetry/otel-arrow v0.34.0
github.com/prometheus/client_golang v1.21.1
github.com/sirupsen/logrus v1.9.3
go.opentelemetry.io/collector/pdata v1.28.1
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1
go.opentelemetry.io/ebpf-profiler v0.0.0-20241025131851-7fa5b1e60d38
go.opentelemetry.io/otel v1.35.0
go.opentelemetry.io/otel/trace v1.35.0
google.golang.org/grpc v1.71.0
google.golang.org/protobuf v1.36.5
)

require (
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/apache/arrow/go/v17 v17.0.0 // indirect
github.com/axiomhq/hyperloglog v0.0.0-20230201085229-3ddf4bad03dc // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cilium/ebpf v0.16.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc // indirect
github.com/elastic/go-freelru v0.16.0 // indirect
github.com/elastic/go-perf v0.0.0-20241016160959-1342461adb4a // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.114.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.10.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/net v0.37.0 // indirect
golang.org/x/sync v0.12.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/tools v0.25.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
)
Loading