Skip to content

Commit ab333d6

Browse files
committed
omg is this finished? tests needed
1 parent f8ad049 commit ab333d6

File tree

8 files changed

+243
-138
lines changed

8 files changed

+243
-138
lines changed

contrib/haproxy/stream-processing-offload/cache.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ func getCurrentRequest(msg *message.Message) (message_processor.RequestState, er
2525
if requestStateCache == nil {
2626
return message_processor.RequestState{}, fmt.Errorf("requestStateCache is not initialized")
2727
}
28-
key := spanIDFromMessage(msg)
29-
if key == 0 {
30-
return message_processor.RequestState{}, fmt.Errorf("span_id not found in message")
28+
key, err := spanIDFromMessage(msg)
29+
if err != nil {
30+
return message_processor.RequestState{}, fmt.Errorf("failed to extract span_id from message: %w", err)
3131
}
32+
3233
if item := requestStateCache.Get(key); item != nil {
3334
if v := item.Value(); v != nil {
3435
return *v, nil
3536
}
3637
}
38+
3739
return message_processor.RequestState{}, fmt.Errorf("no current request found for span_id %d", key)
3840
}
3941

contrib/haproxy/stream-processing-offload/cmd/spoa/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ import (
2020
var log = NewLogger()
2121

2222
func main() {
23-
log.Info("datadog_haproxy_spoa: starting\n")
24-
2523
listener, err := net.Listen("tcp4", "127.0.0.1:3000")
2624
if err != nil {
27-
log.Error("datadog_haproxy_spoa: error create listener, %v", err)
25+
log.Error("haproxy_spoa: error create listener, %v", err)
2826
os.Exit(1)
2927
}
3028
defer listener.Close()
@@ -40,7 +38,8 @@ func main() {
4038

4139
a := agent.New(appsecHAProxy.Handler, logger.NewDefaultLog())
4240

41+
log.Info("haproxy_spoa: started\n")
4342
if err := a.Serve(listener); err != nil {
44-
log.Printf("error agent serve: %+v\n", err)
43+
log.Printf("haproxy_spoa: error agent serve: %+v\n", err)
4544
}
4645
}

contrib/haproxy/stream-processing-offload/go.mod

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,78 +3,96 @@ module github.com/DataDog/dd-trace-go/contrib/haproxy/stream-processing-offload/
33
go 1.23.1
44

55
require (
6+
github.com/DataDog/dd-trace-go/contrib/envoyproxy/go-control-plane/v2 v2.0.0-00010101000000-000000000000
67
github.com/DataDog/dd-trace-go/v2 v2.3.0-dev.1
7-
github.com/negasus/haproxy-spoe-go v1.0.6
88
github.com/jellydator/ttlcache/v3 v3.4.0
9+
github.com/negasus/haproxy-spoe-go v1.0.6
10+
github.com/stretchr/testify v1.10.0
911
)
1012

1113
require (
1214
github.com/DataDog/appsec-internal-go v1.13.0 // indirect
13-
github.com/DataDog/datadog-agent/comp/core/tagger/origindetection v0.66.1 // indirect
14-
github.com/DataDog/datadog-agent/pkg/obfuscate v0.66.1 // indirect
15-
github.com/DataDog/datadog-agent/pkg/proto v0.66.1 // indirect
16-
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.66.1 // indirect
17-
github.com/DataDog/datadog-agent/pkg/trace v0.66.1 // indirect
18-
github.com/DataDog/datadog-agent/pkg/util/log v0.66.1 // indirect
19-
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.66.1 // indirect
20-
github.com/DataDog/datadog-agent/pkg/version v0.66.1 // indirect
15+
github.com/DataDog/datadog-agent/comp/core/tagger/origindetection v0.67.0 // indirect
16+
github.com/DataDog/datadog-agent/pkg/obfuscate v0.67.0 // indirect
17+
github.com/DataDog/datadog-agent/pkg/proto v0.67.0 // indirect
18+
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.67.0 // indirect
19+
github.com/DataDog/datadog-agent/pkg/trace v0.67.0 // indirect
20+
github.com/DataDog/datadog-agent/pkg/util/log v0.67.0 // indirect
21+
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.67.0 // indirect
22+
github.com/DataDog/datadog-agent/pkg/version v0.67.0 // indirect
2123
github.com/DataDog/datadog-go/v5 v5.6.0 // indirect
22-
github.com/DataDog/go-libddwaf/v4 v4.3.0 // indirect
23-
github.com/DataDog/go-runtime-metrics-internal v0.0.4-0.20250603194815-7edb7c2ad56a // indirect
24+
github.com/DataDog/go-libddwaf/v4 v4.3.2 // indirect
25+
github.com/DataDog/go-runtime-metrics-internal v0.0.4-0.20250721125240-fdf1ef85b633 // indirect
2426
github.com/DataDog/go-sqllexer v0.1.6 // indirect
2527
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
26-
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.26.0 // indirect
28+
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.27.0 // indirect
2729
github.com/DataDog/sketches-go v1.4.7 // indirect
2830
github.com/Masterminds/semver/v3 v3.3.1 // indirect
2931
github.com/Microsoft/go-winio v0.6.2 // indirect
3032
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3133
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect
34+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3235
github.com/dustin/go-humanize v1.0.1 // indirect
3336
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4 // indirect
3437
github.com/ebitengine/purego v0.8.3 // indirect
38+
github.com/go-logr/logr v1.4.2 // indirect
39+
github.com/go-logr/stdr v1.2.2 // indirect
3540
github.com/go-ole/go-ole v1.3.0 // indirect
36-
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
41+
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
3742
github.com/gogo/protobuf v1.3.2 // indirect
3843
github.com/golang/protobuf v1.5.4 // indirect
3944
github.com/google/uuid v1.6.0 // indirect
45+
github.com/hashicorp/go-version v1.7.0 // indirect
4046
github.com/json-iterator/go v1.1.12 // indirect
41-
github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a // indirect
47+
github.com/klauspost/compress v1.18.0 // indirect
48+
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
49+
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
50+
github.com/minio/simdjson-go v0.4.5 // indirect
4251
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
43-
github.com/modern-go/reflect2 v1.0.2 // indirect
52+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
4453
github.com/outcaste-io/ristretto v0.2.3 // indirect
4554
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
4655
github.com/pkg/errors v0.9.1 // indirect
4756
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
57+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
4858
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
4959
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
5060
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
51-
github.com/shirou/gopsutil/v4 v4.25.1 // indirect
61+
github.com/shirou/gopsutil/v4 v4.25.3 // indirect
5262
github.com/tinylib/msgp v1.2.5 // indirect
5363
github.com/tklauser/go-sysconf v0.3.14 // indirect
54-
github.com/tklauser/numcpus v0.8.0 // indirect
64+
github.com/tklauser/numcpus v0.9.0 // indirect
5565
github.com/yusufpapurcu/wmi v1.2.4 // indirect
56-
go.opentelemetry.io/collector/component v1.28.1 // indirect
57-
go.opentelemetry.io/collector/pdata v1.28.1 // indirect
58-
go.opentelemetry.io/collector/pdata/pprofile v0.122.1 // indirect
59-
go.opentelemetry.io/collector/semconv v0.122.1 // indirect
66+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
67+
go.opentelemetry.io/collector/component v1.31.0 // indirect
68+
go.opentelemetry.io/collector/featuregate v1.31.0 // indirect
69+
go.opentelemetry.io/collector/internal/telemetry v0.125.0 // indirect
70+
go.opentelemetry.io/collector/pdata v1.31.0 // indirect
71+
go.opentelemetry.io/collector/semconv v0.125.0 // indirect
72+
go.opentelemetry.io/contrib/bridges/otelzap v0.10.0 // indirect
6073
go.opentelemetry.io/otel v1.35.0 // indirect
74+
go.opentelemetry.io/otel/log v0.11.0 // indirect
6175
go.opentelemetry.io/otel/metric v1.35.0 // indirect
76+
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
6277
go.opentelemetry.io/otel/trace v1.35.0 // indirect
6378
go.uber.org/atomic v1.11.0 // indirect
6479
go.uber.org/multierr v1.11.0 // indirect
6580
go.uber.org/zap v1.27.0 // indirect
66-
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac // indirect
67-
golang.org/x/mod v0.23.0 // indirect
81+
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
82+
golang.org/x/mod v0.24.0 // indirect
6883
golang.org/x/net v0.39.0 // indirect
84+
golang.org/x/sync v0.15.0 // indirect
6985
golang.org/x/sys v0.33.0 // indirect
7086
golang.org/x/text v0.24.0 // indirect
7187
golang.org/x/time v0.11.0 // indirect
7288
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
73-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250224174004-546df14abb99 // indirect
74-
google.golang.org/grpc v1.71.1 // indirect
89+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250425173222-7b384671a197 // indirect
90+
google.golang.org/grpc v1.72.0 // indirect
7591
google.golang.org/protobuf v1.36.6 // indirect
7692
gopkg.in/ini.v1 v1.67.0 // indirect
7793
gopkg.in/yaml.v3 v3.0.1 // indirect
7894
)
7995

80-
replace github.com/DataDog/dd-trace-go/v2 => ../../..
96+
replace github.com/DataDog/dd-trace-go/v2 => ../../..
97+
98+
replace github.com/DataDog/dd-trace-go/contrib/envoyproxy/go-control-plane/v2 => ../../envoyproxy/go-control-plane

0 commit comments

Comments
 (0)