diff --git a/Makefile b/Makefile index 08a5ecfaa..1dcb20729 100644 --- a/Makefile +++ b/Makefile @@ -352,8 +352,13 @@ oats-test-kafka: oats-prereq mkdir -p test/oats/kafka/$(TEST_OUTPUT)/run cd test/oats/kafka && TESTCASE_TIMEOUT=120s TESTCASE_BASE_PATH=./yaml $(GINKGO) -v -r +.PHONY: oats-test-http +oats-test-http: oats-prereq + mkdir -p test/oats/http/$(TEST_OUTPUT)/run + cd test/oats/http && TESTCASE_BASE_PATH=./yaml $(GINKGO) -v -r + .PHONY: oats-test -oats-test: oats-test-sql oats-test-redis oats-test-kafka +oats-test: oats-test-sql oats-test-redis oats-test-kafka oats-test-http $(MAKE) itest-coverage-data .PHONY: oats-test-debug diff --git a/bpf/http_types.h b/bpf/http_types.h index 2aba3c041..2b398dc05 100644 --- a/bpf/http_types.h +++ b/bpf/http_types.h @@ -192,6 +192,7 @@ typedef struct http2_grpc_request { // with other instrumented processes pid_info pid; u8 ssl; + u8 new_conn; tp_info_t tp; } http2_grpc_request_t; diff --git a/bpf/k_tracer_defs.h b/bpf/k_tracer_defs.h index 23865479e..80c6e276d 100644 --- a/bpf/k_tracer_defs.h +++ b/bpf/k_tracer_defs.h @@ -42,11 +42,14 @@ static __always_inline void handle_buf_with_args(void *ctx, call_protocol_args_t bpf_tail_call(ctx, &jump_table, k_tail_protocol_http); } else if (is_http2_or_grpc(args->small_buf, MIN_HTTP2_SIZE)) { bpf_dbg_printk("Found HTTP2 or gRPC connection"); - u8 is_ssl = args->ssl; - bpf_map_update_elem(&ongoing_http2_connections, &args->pid_conn, &is_ssl, BPF_ANY); + u8 flags = http2_conn_flag_new; + if (args->ssl) { + flags |= http2_conn_flag_ssl; + } + bpf_map_update_elem(&ongoing_http2_connections, &args->pid_conn, &flags, BPF_ANY); } else { u8 *h2g = bpf_map_lookup_elem(&ongoing_http2_connections, &args->pid_conn); - if (h2g && *h2g == args->ssl) { + if (h2g && (http2_flag_ssl(*h2g) == args->ssl)) { bpf_tail_call(ctx, &jump_table, k_tail_protocol_http2); } else { // large request tracking http_info_t *info = bpf_map_lookup_elem(&ongoing_http, &args->pid_conn); diff --git a/bpf/protocol_http2.h b/bpf/protocol_http2.h index 7334aa0ff..8ec12bf79 100644 --- a/bpf/protocol_http2.h +++ b/bpf/protocol_http2.h @@ -10,10 +10,13 @@ #include "protocol_common.h" #include "ringbuf.h" +// These are bit flags, if you add any use power of 2 values +enum { http2_conn_flag_ssl = WITH_SSL, http2_conn_flag_new = 0x2 }; + struct { __uint(type, BPF_MAP_TYPE_LRU_HASH); __type(key, pid_connection_info_t); - __type(value, u8); // ssl or not + __type(value, u8); // flags __uint(max_entries, MAX_CONCURRENT_REQUESTS); } ongoing_http2_connections SEC(".maps"); @@ -62,6 +65,14 @@ static __always_inline grpc_frames_ctx_t *grpc_ctx() { return bpf_map_lookup_elem(&grpc_frames_ctx_mem, &zero); } +static __always_inline u8 http2_flag_ssl(u8 flags) { + return flags & http2_conn_flag_ssl; +} + +static __always_inline u8 http2_flag_new(u8 flags) { + return flags & http2_conn_flag_new; +} + static __always_inline http2_grpc_request_t *empty_http2_info() { int zero = 0; http2_grpc_request_t *value = bpf_map_lookup_elem(&http2_info_mem, &zero); @@ -98,6 +109,13 @@ static __always_inline void http2_grpc_start( h2g_info->pid = meta->pid; h2g_info->type = meta->type; } + + h2g_info->new_conn = 0; + u8 *h2g = bpf_map_lookup_elem(&ongoing_http2_connections, &s_key->pid_conn); + if (h2g && http2_flag_new(*h2g)) { + h2g_info->new_conn = 1; + } + fixup_connection_info( &h2g_info->conn_info, h2g_info->type == EVENT_HTTP_CLIENT, orig_dport); bpf_probe_read(h2g_info->data, KPROBES_HTTP2_BUF_SIZE, u_buf); diff --git a/pkg/internal/ebpf/bhpack/hpack.go b/pkg/internal/ebpf/bhpack/hpack.go index 6534c62a6..1cbd57923 100644 --- a/pkg/internal/ebpf/bhpack/hpack.go +++ b/pkg/internal/ebpf/bhpack/hpack.go @@ -95,7 +95,8 @@ type Decoder struct { // to fully parse before. Unlike buf, we own this data. saveBuf bytes.Buffer - firstField bool // processing the first field of the header block + firstField bool // processing the first field of the header block + failedToIndex bool } // NewDecoder returns a new decoder with the provided maximum dynamic @@ -103,9 +104,10 @@ type Decoder struct { // parsed, in the same goroutine as calls to Write, before Write returns. func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decoder { d := &Decoder{ - emit: emitFunc, - emitEnabled: true, - firstField: true, + emit: emitFunc, + emitEnabled: true, + firstField: true, + failedToIndex: false, } d.dynTab.table.init() d.dynTab.allowedMaxSize = maxDynamicTableSize @@ -345,7 +347,10 @@ func (d *Decoder) parseFieldIndexed() error { } hf, ok := d.at(idx) d.buf = buf + // If we've failed once to find an index, don't allow us to find + // a value for index that's greater than the last successful one if !ok { + d.failedToIndex = true return d.callEmit(HeaderField{Name: "", Value: ""}) } return d.callEmit(HeaderField{Name: hf.Name, Value: hf.Value}) @@ -392,7 +397,7 @@ func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { } } d.buf = buf - if it.indexed() { + if it.indexed() && !d.failedToIndex { d.dynTab.add(hf) } hf.Sensitive = it.sensitive() diff --git a/pkg/internal/ebpf/common/bpf_arm64_bpfel.go b/pkg/internal/ebpf/common/bpf_arm64_bpfel.go index df560f91c..716ffbf20 100644 --- a/pkg/internal/ebpf/common/bpf_arm64_bpfel.go +++ b/pkg/internal/ebpf/common/bpf_arm64_bpfel.go @@ -35,9 +35,10 @@ type bpfHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/common/bpf_arm64_bpfel.o b/pkg/internal/ebpf/common/bpf_arm64_bpfel.o index 915925426..dee72b0d2 100644 --- a/pkg/internal/ebpf/common/bpf_arm64_bpfel.o +++ b/pkg/internal/ebpf/common/bpf_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b01d5155416c0085c68af36e96ae7d5991ed6222402a7d403a93086c2beee68 -size 4544 +oid sha256:73302bb00ece4f200a40e33ef3d9a91d25b61b3a4048b048950e9a754fd872ab +size 4568 diff --git a/pkg/internal/ebpf/common/bpf_x86_bpfel.go b/pkg/internal/ebpf/common/bpf_x86_bpfel.go index 8b042d4fa..9a5e18bc4 100644 --- a/pkg/internal/ebpf/common/bpf_x86_bpfel.go +++ b/pkg/internal/ebpf/common/bpf_x86_bpfel.go @@ -35,9 +35,10 @@ type bpfHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/common/bpf_x86_bpfel.o b/pkg/internal/ebpf/common/bpf_x86_bpfel.o index 915925426..dee72b0d2 100644 --- a/pkg/internal/ebpf/common/bpf_x86_bpfel.o +++ b/pkg/internal/ebpf/common/bpf_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b01d5155416c0085c68af36e96ae7d5991ed6222402a7d403a93086c2beee68 -size 4544 +oid sha256:73302bb00ece4f200a40e33ef3d9a91d25b61b3a4048b048950e9a754fd872ab +size 4568 diff --git a/pkg/internal/ebpf/common/http2grpc_transform.go b/pkg/internal/ebpf/common/http2grpc_transform.go index 2fa21d035..1cb4fd747 100644 --- a/pkg/internal/ebpf/common/http2grpc_transform.go +++ b/pkg/internal/ebpf/common/http2grpc_transform.go @@ -27,6 +27,8 @@ const ( GRPC ) +const initialHeaderTableSize = 4096 + type h2Connection struct { hdec *bhpack.Decoder hdecRet *bhpack.Decoder @@ -45,13 +47,18 @@ func byteFramer(data []uint8) *http2.Framer { return fr } -func getOrInitH2Conn(conn *BPFConnInfo) *h2Connection { +func getOrInitH2Conn(conn *BPFConnInfo, newConn bool) *h2Connection { v, ok := activeGRPCConnections.Get(*conn) + dynamicTableSize := initialHeaderTableSize + if !newConn { + dynamicTableSize = 0 + } + if !ok { h := h2Connection{ - hdec: bhpack.NewDecoder(0, nil), - hdecRet: bhpack.NewDecoder(0, nil), + hdec: bhpack.NewDecoder(uint32(dynamicTableSize), nil), + hdecRet: bhpack.NewDecoder(uint32(dynamicTableSize), nil), protocol: HTTP2, } activeGRPCConnections.Add(*conn, h) @@ -64,8 +71,8 @@ func getOrInitH2Conn(conn *BPFConnInfo) *h2Connection { return &v } -func protocolIsGRPC(conn *BPFConnInfo) { - h2c := getOrInitH2Conn(conn) +func protocolIsGRPC(conn *BPFConnInfo, newConn bool) { + h2c := getOrInitH2Conn(conn, newConn) if h2c != nil { h2c.protocol = GRPC } @@ -102,8 +109,8 @@ func knownFrameKeys(fr *http2.Framer, hf *http2.HeadersFrame) bool { return known } -func readMetaFrame(conn *BPFConnInfo, fr *http2.Framer, hf *http2.HeadersFrame) (string, string, string, bool) { - h2c := getOrInitH2Conn(conn) +func readMetaFrame(conn *BPFConnInfo, newConn bool, fr *http2.Framer, hf *http2.HeadersFrame) (string, string, string, bool) { + h2c := getOrInitH2Conn(conn, newConn) ok := false method := "" @@ -126,7 +133,7 @@ func readMetaFrame(conn *BPFConnInfo, fr *http2.Framer, hf *http2.HeadersFrame) case "content-type": contentType = strings.ToLower(hf.Value) if contentType == "application/grpc" { - protocolIsGRPC(conn) + protocolIsGRPC(conn, newConn) } ok = true } @@ -162,8 +169,8 @@ func http2grpcStatus(status int) int { return 2 // Unknown } -func readRetMetaFrame(conn *BPFConnInfo, fr *http2.Framer, hf *http2.HeadersFrame) (int, bool, bool) { - h2c := getOrInitH2Conn(conn) +func readRetMetaFrame(conn *BPFConnInfo, newConn bool, fr *http2.Framer, hf *http2.HeadersFrame) (int, bool, bool) { + h2c := getOrInitH2Conn(conn, newConn) ok := false status := 0 @@ -184,7 +191,7 @@ func readRetMetaFrame(conn *BPFConnInfo, fr *http2.Framer, hf *http2.HeadersFram ok = true case "grpc-status": status, _ = strconv.Atoi(hf.Value) - protocolIsGRPC(conn) + protocolIsGRPC(conn, newConn) grpc = true ok = true } @@ -276,6 +283,11 @@ func http2FromBuffers(event *BPFHTTP2Info) (request.Span, bool, error) { status := 0 eventType := HTTP2 + newConn := true + if event.NewConn == 0 { + newConn = false + } + for { f, err := framer.ReadFrame() @@ -285,7 +297,7 @@ func http2FromBuffers(event *BPFHTTP2Info) (request.Span, bool, error) { if ff, ok := f.(*http2.HeadersFrame); ok { rok := false - method, path, contentType, ok := readMetaFrame((*BPFConnInfo)(&event.ConnInfo), framer, ff) + method, path, contentType, ok := readMetaFrame((*BPFConnInfo)(&event.ConnInfo), newConn, framer, ff) if path == "" { path = "*" @@ -301,7 +313,7 @@ func http2FromBuffers(event *BPFHTTP2Info) (request.Span, bool, error) { } if ff, ok := retF.(*http2.HeadersFrame); ok { - status, grpcInStatus, rok = readRetMetaFrame((*BPFConnInfo)(&event.ConnInfo), retFramer, ff) + status, grpcInStatus, rok = readRetMetaFrame((*BPFConnInfo)(&event.ConnInfo), newConn, retFramer, ff) break } } diff --git a/pkg/internal/ebpf/common/http2grpc_transform_test.go b/pkg/internal/ebpf/common/http2grpc_transform_test.go index 7ef53fca9..54514f38f 100644 --- a/pkg/internal/ebpf/common/http2grpc_transform_test.go +++ b/pkg/internal/ebpf/common/http2grpc_transform_test.go @@ -119,10 +119,10 @@ func TestHTTP2Parsing(t *testing.T) { if ff, ok := f.(*http2.HeadersFrame); ok { connInfo := BPFConnInfo{} - method, path, contentType, _ := readMetaFrame(&connInfo, framer, ff) - assert.Equal(t, method, tt.method) - assert.Equal(t, path, tt.path) - assert.Equal(t, contentType, tt.contentType) + method, path, contentType, _ := readMetaFrame(&connInfo, false, framer, ff) + assert.Equal(t, tt.method, method) + assert.Equal(t, tt.path, path) + assert.Equal(t, tt.contentType, contentType) } } }) @@ -169,6 +169,74 @@ func TestHTTP2EventsParsing(t *testing.T) { } } +func TestDynamicTableUpdates(t *testing.T) { + rinput := []byte{0, 0, 138, 1, 36, 0, 0, 0, 11, 0, 0, 0, 0, 15, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + + tests := []struct { + name string + input []byte + inputLen int + }{ + { + name: "Full path, lots of headers", + input: []byte{0, 0, 222, 1, 4, 0, 0, 0, 1, 64, 5, 58, 112, 97, 116, 104, 33, 47, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 111, 117, 116, 101, 71, 117, 105, 100, 101, 47, 71, 101, 116, 70, 101, 97, 116, 117, 114, 101, 64, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 15, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 53, 48, 48, 53, 49, 131, 134, 64, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 64, 2, 116, 101, 8, 116, 114, 97, 105, 108, 101, 114, 115, 64, 20, 103, 114, 112, 99, 45, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 23, 105, 100, 101, 110, 116, 105, 116, 121, 44, 32, 100, 101, 102, 108, 97, 116, 101, 44, 32, 103, 122, 105, 112, 64, 10, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, 48, 103, 114, 112, 99, 45, 112, 121, 116, 104, 111, 110, 47, 49, 46, 54, 57, 46, 48, 32, 103, 114, 112, 99, 45, 99, 47, 52, 52, 46, 50, 46, 48, 32, 40, 108, 105, 110, 117, 120, 59, 32, 99, 104, 116, 116, 112, 50, 41, 0, 0, 4, 8, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 22, 0, 1, 0, 0, 0, 1, 0, 0, 0}, + inputLen: 1024, + }, + { + name: "Full path only", + input: []byte{0, 0, 222, 1, 4, 0, 0, 0, 1, 64, 5, 58, 112, 97, 116, 104, 33, 47, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 111, 117, 116, 101, 71, 117, 105, 100, 101, 47, 71, 101, 116, 70, 101, 97, 116, 117, 114, 101, 131}, + inputLen: 1024, + }, + { + name: "Index encoded", + input: []byte{0, 0, 8, 1, 4, 0, 0, 0, 3, 195, 194, 131, 134, 193, 192, 191, 190, 0, 0, 4, 8, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 5, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 84}, + inputLen: 1024, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + info := makeBPFHTTP2InfoNewRequest(tt.input, rinput, tt.inputLen) + s, ignore, _ := http2FromBuffers(&info) + assert.False(t, ignore) + assert.Equal(t, "POST", s.Method) + assert.Equal(t, "/routeguide.RouteGuide/GetFeature", s.Path) + }) + } + + // Now let's break the decoder with pushing unknown indices + unknownIndexInput := []byte{0, 0, 8, 1, 4, 0, 0, 0, 3, 199, 200, 131, 134, 201, 202, 203, 204, 0, 0, 4, 8, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 5, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 84} + + info := makeBPFHTTP2InfoNewRequest(unknownIndexInput, rinput, 1024) + s, ignore, _ := http2FromBuffers(&info) + assert.False(t, ignore) + assert.Equal(t, "POST", s.Method) + assert.Equal(t, "*", s.Path) + + nextIndex := 8 + 61 // 61 is the static table index size, 7 is how many entries we store in the dynamic table with that first request + + // Now let's send new path + newPathInput := []byte{0, 0, 222, 1, 4, 0, 0, 0, 1, 64, 5, 58, 112, 97, 116, 104, 33, 47, 112, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 111, 117, 116, 101, 71, 117, 105, 100, 101, 47, 71, 101, 116, 70, 101, 97, 116, 117, 114, 101, 64, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 15, 108, 111, 99, 97, 108, 104, 111, 115, 116, 58, 53, 48, 48, 53, 49, 131, 134, 64, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 64, 2, 116, 101, 8, 116, 114, 97, 105, 108, 101, 114, 115, 64, 20, 103, 114, 112, 99, 45, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 23, 105, 100, 101, 110, 116, 105, 116, 121, 44, 32, 100, 101, 102, 108, 97, 116, 101, 44, 32, 103, 122, 105, 112, 64, 10, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, 48, 103, 114, 112, 99, 45, 112, 121, 116, 104, 111, 110, 47, 49, 46, 54, 57, 46, 48, 32, 103, 114, 112, 99, 45, 99, 47, 52, 52, 46, 50, 46, 48, 32, 40, 108, 105, 110, 117, 120, 59, 32, 99, 104, 116, 116, 112, 50, 41, 0, 0, 4, 8, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 22, 0, 1, 0, 0, 0, 1, 0, 0, 0} + + // We'll be able to decode this correctly, even with broken decoder, beause the values are sent as text + info = makeBPFHTTP2InfoNewRequest(newPathInput, rinput, 1024) + s, ignore, _ = http2FromBuffers(&info) + assert.False(t, ignore) + assert.Equal(t, "POST", s.Method) + assert.Equal(t, "/pouteguide.RouteGuide/GetFeature", s.Path) // this value is the same I just changed the first character from r to p + + // indexed version of newPathInput + // if we cached a new pair nextIndex + 128 is the high bit encoded next index which should be in the dynamic table + // however we mark the decoder as invalid and it shouldn't resolve to anything for :path + indexedNewPath := []byte{0, 0, 8, 1, 4, 0, 0, 0, 3, 195, 194, 131, 134, 193, 192, 191, byte(nextIndex + 128), 0, 0, 4, 8, 0, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 5, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 84} + + info = makeBPFHTTP2InfoNewRequest(indexedNewPath, rinput, 1024) + s, ignore, _ = http2FromBuffers(&info) + assert.False(t, ignore) + assert.Equal(t, "POST", s.Method) + assert.Equal(t, "*", s.Path) // this value is the same I just changed the first character from r to p +} + func makeBPFHTTP2Info(buf, rbuf []byte, len int) BPFHTTP2Info { var info BPFHTTP2Info copy(info.Data[:], buf) @@ -177,3 +245,12 @@ func makeBPFHTTP2Info(buf, rbuf []byte, len int) BPFHTTP2Info { return info } + +func makeBPFHTTP2InfoNewRequest(buf, rbuf []byte, len int) BPFHTTP2Info { + info := makeBPFHTTP2Info(buf, rbuf, len) + info.ConnInfo.D_port = 1 + info.ConnInfo.S_port = 1 + info.NewConn = 1 + + return info +} diff --git a/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.go index e0887721f..52f4273cd 100644 --- a/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.go @@ -72,9 +72,10 @@ type bpfHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.o index 5951322ce..9e7ad8ec5 100644 --- a/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcdc1f07c4ee5114b44339bc694546f9d07038600160dc72a1b21fb86f9ef78d -size 645256 +oid sha256:66a5834be250d852f3ff8681562777dd2820a37640bafa8b7f96996226ce86bc +size 646984 diff --git a/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.go index 2c698fa52..9698adc57 100644 --- a/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.go @@ -72,9 +72,10 @@ type bpf_debugHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.o index 6bf108f07..20c6184ce 100644 --- a/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_debug_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1536d7cb7585209db54bb853fe2606a6238385b8c92697ca651881d24c9b1e45 -size 1084848 +oid sha256:fd036a5c565dcfe584f27aa84ae8589174e984a8cd7919344edbee1d49889966 +size 1086432 diff --git a/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.go index 6b16ec46e..a29aa003e 100644 --- a/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.go @@ -72,9 +72,10 @@ type bpf_debugHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.o index d8e26eeda..5160a427e 100644 --- a/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_debug_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:329c2954481226e96a085cf321daf265014d1ae677c26f1e4a0c7ba231c1db25 -size 1084416 +oid sha256:f01ac41cfbb4308e241a555a786d879b2763a50fdffd9d6ac4e3b0327ee874a4 +size 1086000 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.go index a6a82e09b..5c1dd8d5d 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.go @@ -72,9 +72,10 @@ type bpf_tpHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.o index 225beeefe..c663c0e0f 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_tp_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c193f5fbece138503579abf8d3888e3ac944fd393fe0a7cd44a7edd33a0acfd -size 659768 +oid sha256:a603d9d4d5f27881f91311bbf74a00638258452f5341fa216778d45bda5f1c91 +size 661496 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.go index e5120334c..069a33c39 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.go @@ -72,9 +72,10 @@ type bpf_tp_debugHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.o index 07efd71fa..066f3596e 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_tp_debug_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d192f2a02bfa77ac7f0d4c2d3387ca32e31a0c4b79d5402785e8ed34667f46d -size 1103216 +oid sha256:0af0f30468e74eba5a30ba973ecb694b66350295ad59b9ed5d88ae9fa684125d +size 1104808 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.go index b08c7b797..6ddd98b4d 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.go @@ -72,9 +72,10 @@ type bpf_tp_debugHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.o index 104d78a31..5a3770cd1 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_tp_debug_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77c21f472e612855f6aff05ca5e424cdef6adb6403f78071914184b0123170d5 -size 1102792 +oid sha256:ac2f1f609aee84bc6144294688b79f719ef82cef6a770070bebfe815a76ea099 +size 1104376 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.go index 0a3c3b357..4743fa254 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.go @@ -72,9 +72,10 @@ type bpf_tpHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.o index c737e870a..6b1512ad8 100644 --- a/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_tp_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ff5b5de058dea184dbcf9495f04b382ed58b67c68f1b516eabf3018fb762b49 -size 659160 +oid sha256:9f7de1a19f19e514b8fdea2e89923398b90962d37c27a0927068fe9b2165a0de +size 660880 diff --git a/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.go b/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.go index 596f229e8..2260487fd 100644 --- a/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.go +++ b/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.go @@ -72,9 +72,10 @@ type bpfHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.o b/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.o index 446cadbc1..7f70294ea 100644 --- a/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.o +++ b/pkg/internal/ebpf/generictracer/bpf_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97cf5b31bdc498b8dabee52d4d1985bc32578766a8d00e4a5c1c6c4cc048baa8 -size 644640 +oid sha256:f69ee7374691d11c79d71c61f5af0e101b5cb44ab16b786ce46ed3f1599a978a +size 646360 diff --git a/pkg/internal/ebpf/generictracer/generictracer.go b/pkg/internal/ebpf/generictracer/generictracer.go index 8a804bcc2..647235049 100644 --- a/pkg/internal/ebpf/generictracer/generictracer.go +++ b/pkg/internal/ebpf/generictracer/generictracer.go @@ -499,7 +499,7 @@ func (p *Tracer) watchForMisclassifedEvents() { if p.bpfObjects.OngoingHttp2Connections != nil { err := p.bpfObjects.OngoingHttp2Connections.Put( &bpfPidConnectionInfoT{Conn: bpfConnectionInfoT(e.TCPInfo.ConnInfo), Pid: e.TCPInfo.Pid.HostPid}, - uint8(e.TCPInfo.Ssl), + uint8(e.TCPInfo.Ssl), // no new connection flag (0x3) ) if err != nil { p.log.Debug("error writing HTTP2/gRPC connection info", "error", err) diff --git a/pkg/internal/ebpf/gotracer/bpf_arm64_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_arm64_bpfel.o index 3da339128..3d53c0cbd 100644 --- a/pkg/internal/ebpf/gotracer/bpf_arm64_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:847c8ff991a0918c3745f9b1c1566bdb4f658807a526858330b5cd73916ad19c -size 390960 +oid sha256:56441ec400ed8947cbb5b74593cbd1ffa48b9af2b3f17e428caf99d5f230510c +size 390984 diff --git a/pkg/internal/ebpf/gotracer/bpf_debug_arm64_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_debug_arm64_bpfel.o index bca92e09c..f4c7520b8 100644 --- a/pkg/internal/ebpf/gotracer/bpf_debug_arm64_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_debug_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:df1cc38ba9381e772197ac7676b02e1524bb8b6b93c0745de72d142714f6d8d2 -size 905920 +oid sha256:d47583646d226de5184050386bfdd36893de60bdb81a5cfda3a32d4ec174652f +size 905944 diff --git a/pkg/internal/ebpf/gotracer/bpf_debug_x86_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_debug_x86_bpfel.o index 268ff7cae..9bc64067d 100644 --- a/pkg/internal/ebpf/gotracer/bpf_debug_x86_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_debug_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:15eb02d9c58a1c2d0b6a783f5b3519331d1e5dca04ea42760493d9fa38140b5f -size 907720 +oid sha256:1d502dab8f942fa4616411b3f327ce7d98b59cd24ad335a45d9ceefb09593547 +size 907736 diff --git a/pkg/internal/ebpf/gotracer/bpf_tp_arm64_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_tp_arm64_bpfel.o index 32e73a89c..e4918f9a3 100644 --- a/pkg/internal/ebpf/gotracer/bpf_tp_arm64_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_tp_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81edf27bb49a33fc71edc64e5caba1f1913a71141c4e06ebc73c4b05eb9b37d1 -size 438824 +oid sha256:88ea9b3729c18f61f1c9220ecc6b6181e2ecb8d99a009ade6ed3f9b4c3e3801f +size 438848 diff --git a/pkg/internal/ebpf/gotracer/bpf_tp_debug_arm64_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_tp_debug_arm64_bpfel.o index 22ebac292..a2d165c0c 100644 --- a/pkg/internal/ebpf/gotracer/bpf_tp_debug_arm64_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_tp_debug_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2aca82b6008b43d9e355b8b23cdcf0f38427c61d727ab9aca6c35ebaedac9538 -size 1008888 +oid sha256:b3fcbc4e6237bf26410d56878169a5edb661f3ac24370ef17e05562dee0ad023 +size 1008912 diff --git a/pkg/internal/ebpf/gotracer/bpf_tp_debug_x86_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_tp_debug_x86_bpfel.o index cc4053b89..bf61fe0bf 100644 --- a/pkg/internal/ebpf/gotracer/bpf_tp_debug_x86_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_tp_debug_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4ae1185314ecd82d56f6739a8f01df3c85a71744f147b48a6513b0dd2807785a -size 1010680 +oid sha256:bf779e41adf555614d097139c00b5cad35e721baa8d6ed4f49b652d129ba2e87 +size 1010704 diff --git a/pkg/internal/ebpf/gotracer/bpf_tp_x86_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_tp_x86_bpfel.o index fb7e51fde..45836df5e 100644 --- a/pkg/internal/ebpf/gotracer/bpf_tp_x86_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_tp_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a899579c0797ff61499c6be4e46c511f58c58aca30262caaac823da683414a2a -size 440592 +oid sha256:c5eb368905a6404c32f127b19f37b01616b61bf5ee7c42a82508a01e845f030f +size 440608 diff --git a/pkg/internal/ebpf/gotracer/bpf_x86_bpfel.o b/pkg/internal/ebpf/gotracer/bpf_x86_bpfel.o index 08505cb68..1c8f6bfea 100644 --- a/pkg/internal/ebpf/gotracer/bpf_x86_bpfel.o +++ b/pkg/internal/ebpf/gotracer/bpf_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:41da4188cb3f72643a6d7ac07b5d5affb677c6db0ed80d5ca42ab7af6ec65688 -size 392776 +oid sha256:7bd82e2c14a66eff52af72d340004affce4487c5051927f6948aeda0d7881e7b +size 392800 diff --git a/pkg/internal/ebpf/httptracer/bpf_arm64_bpfel.o b/pkg/internal/ebpf/httptracer/bpf_arm64_bpfel.o index 729c29259..3151aa74a 100644 --- a/pkg/internal/ebpf/httptracer/bpf_arm64_bpfel.o +++ b/pkg/internal/ebpf/httptracer/bpf_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e3f513908bbc610bacb2fe8b2ca56e185819c1cb7902eb217cf86704f489efa5 -size 43064 +oid sha256:0a3ff765845b4f3aabce4ad69f6cd15a93de2909b0b5b40e137d0504bc777ea9 +size 43088 diff --git a/pkg/internal/ebpf/httptracer/bpf_debug_arm64_bpfel.o b/pkg/internal/ebpf/httptracer/bpf_debug_arm64_bpfel.o index a3a27c02a..86263825d 100644 --- a/pkg/internal/ebpf/httptracer/bpf_debug_arm64_bpfel.o +++ b/pkg/internal/ebpf/httptracer/bpf_debug_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef5c85c4517fab358605fa9f4ee7b06fe72136ce2a1dc2b2e06b5e13fbb16d34 -size 43304 +oid sha256:0abbd5cad95609e163550388185b552c0d521e8c8e30d606cbc678c7a7be6c1f +size 43328 diff --git a/pkg/internal/ebpf/httptracer/bpf_debug_x86_bpfel.o b/pkg/internal/ebpf/httptracer/bpf_debug_x86_bpfel.o index 186b009bb..6ef1e1209 100644 --- a/pkg/internal/ebpf/httptracer/bpf_debug_x86_bpfel.o +++ b/pkg/internal/ebpf/httptracer/bpf_debug_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e6dd04239760b2a11b9979660bfbae3b898378dd2221a5ca5d6623e0289df8cd -size 43192 +oid sha256:1f1a24355bfcfce4e63be60e88737624f5435d0f910f6825c382cff619d9e669 +size 43208 diff --git a/pkg/internal/ebpf/httptracer/bpf_x86_bpfel.o b/pkg/internal/ebpf/httptracer/bpf_x86_bpfel.o index d3530eda9..913abd24d 100644 --- a/pkg/internal/ebpf/httptracer/bpf_x86_bpfel.o +++ b/pkg/internal/ebpf/httptracer/bpf_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a67d0430f7ac630bc456f40a34f0418d8f8cf728c3bef5b31a9d773770d11733 -size 42952 +oid sha256:cd3d07881b23186a82efba2ce07829843490a2f9a6f503ceab163ed13fb546b2 +size 42968 diff --git a/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.go b/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.go index 2dc75fdf1..efb716c88 100644 --- a/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.go +++ b/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.go @@ -77,9 +77,10 @@ type bpfHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.o b/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.o index f00cdf30a..3eecdf610 100644 --- a/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.o +++ b/pkg/internal/ebpf/tctracer/bpf_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:23e2e10e2cc53cdaac2a79c6f817dbdd256027f095a707d892b9c94fedd1143d -size 220560 +oid sha256:96cc834c6723765e2a5b1797a3d20ca16869a5600dbf2e19529f0f6d782a7f8c +size 221344 diff --git a/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.go b/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.go index 5188214c0..e4ab0f9bf 100644 --- a/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.go +++ b/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.go @@ -77,9 +77,10 @@ type bpf_debugHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.o b/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.o index 31072f068..b0318a4d9 100644 --- a/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.o +++ b/pkg/internal/ebpf/tctracer/bpf_debug_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2ea3ee9144845c89488ceeeef2b9d9985105ed853134c7e88cf61e995dd5507e -size 402224 +oid sha256:4048be209ec7ebb02c8cbf4f3569b821431ae135d251b78c63922f16c10521b4 +size 402880 diff --git a/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.go b/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.go index 7b88afc42..416482e0d 100644 --- a/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.go +++ b/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.go @@ -77,9 +77,10 @@ type bpf_debugHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.o b/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.o index ea6a0a26f..9167cae72 100644 --- a/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.o +++ b/pkg/internal/ebpf/tctracer/bpf_debug_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a2e21f6506079aa1a6dfc5397d434d481fd52aaa27c9b9988750f914f2b54706 -size 403536 +oid sha256:ff496544d9caabc646a7985fed949122fb5aaf0ead497c644cb9bc7cd2d6091a +size 404184 diff --git a/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.go b/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.go index 29ba9ea43..99b9325b7 100644 --- a/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.go +++ b/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.go @@ -77,9 +77,10 @@ type bpfHttp2GrpcRequestT struct { UserPid uint32 Ns uint32 } - Ssl uint8 - _ [3]byte - Tp struct { + Ssl uint8 + NewConn uint8 + _ [2]byte + Tp struct { TraceId [16]uint8 SpanId [8]uint8 ParentId [8]uint8 diff --git a/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.o b/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.o index c5db66654..4b68f8a66 100644 --- a/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.o +++ b/pkg/internal/ebpf/tctracer/bpf_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6bc03134968700d4c937db9bbc78e2b95f254a2a188fbb9e6e0388575c2ab1a8 -size 221872 +oid sha256:2e9fcee0b5aa7a4ef96053339f437adacd3f0b18dc04a0b985381ac4404af3e3 +size 222656 diff --git a/pkg/internal/ebpf/watcher/bpf_arm64_bpfel.o b/pkg/internal/ebpf/watcher/bpf_arm64_bpfel.o index 98a4e9d57..df00667ad 100644 --- a/pkg/internal/ebpf/watcher/bpf_arm64_bpfel.o +++ b/pkg/internal/ebpf/watcher/bpf_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0627e038d0ee350f32d40c21225a269088f7ad810d7f6c6241216788289bcf46 -size 7032 +oid sha256:2a8df0799b4c73e55a8f1ee27b3642fe6b615bd1627731c1fb9bde524156c096 +size 7048 diff --git a/pkg/internal/ebpf/watcher/bpf_debug_arm64_bpfel.o b/pkg/internal/ebpf/watcher/bpf_debug_arm64_bpfel.o index b37f85777..079cabcbf 100644 --- a/pkg/internal/ebpf/watcher/bpf_debug_arm64_bpfel.o +++ b/pkg/internal/ebpf/watcher/bpf_debug_arm64_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcab44d7866cba84db2cac9ff13705d4c6889f56955de571fc831e16d77e1240 -size 8992 +oid sha256:f740a5d91afb73e9875c99631987759efa71b9045da65830dbfa712e8bb6feb9 +size 9016 diff --git a/pkg/internal/ebpf/watcher/bpf_debug_x86_bpfel.o b/pkg/internal/ebpf/watcher/bpf_debug_x86_bpfel.o index 870bd7892..85d38b7d0 100644 --- a/pkg/internal/ebpf/watcher/bpf_debug_x86_bpfel.o +++ b/pkg/internal/ebpf/watcher/bpf_debug_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a64972250017442b0ddf0cb4d444c0c5cf33b096612739b73b31420f7f689d2a -size 8848 +oid sha256:9959fd5e551f2bde2642f4f4c80cf12479dff8826c3d36c8d9931c2cf3ce8c8b +size 8872 diff --git a/pkg/internal/ebpf/watcher/bpf_x86_bpfel.o b/pkg/internal/ebpf/watcher/bpf_x86_bpfel.o index 2a4dfc9ec..55021ac4a 100644 --- a/pkg/internal/ebpf/watcher/bpf_x86_bpfel.o +++ b/pkg/internal/ebpf/watcher/bpf_x86_bpfel.o @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3cb172d7908eac9a64d27d0620587b0753267111139484803ea5c0ab56cd1408 -size 6888 +oid sha256:1969d6dcd9ec0fcd97df39fa6f213191bb7a3a62461c30416ad529dbfb0f260f +size 6912 diff --git a/test/integration/components/pythongrpc/Dockerfile b/test/integration/components/pythongrpc/Dockerfile new file mode 100644 index 000000000..56df28ebf --- /dev/null +++ b/test/integration/components/pythongrpc/Dockerfile @@ -0,0 +1,11 @@ +# Dockerfile that will build a container that runs python with FastAPI and uvicorn on port 8080 +FROM python:3.12 +EXPOSE 8080 +RUN pip install fastapi uvicorn grpcio grpcio_tools +COPY main.py /main.py +COPY route_guide_db.json /route_guide_db.json +COPY route_guide_pb2_grpc.py /route_guide_pb2_grpc.py +COPY route_guide_pb2.py /route_guide_pb2.py +COPY route_guide_pb2.pyi /route_guide_pb2.pyi +COPY route_guide_resources.py /route_guide_resources.py +CMD ["uvicorn", "--port", "8080", "--host", "0.0.0.0", "main:app"] \ No newline at end of file diff --git a/test/integration/components/pythongrpc/Dockerfile_srv b/test/integration/components/pythongrpc/Dockerfile_srv new file mode 100644 index 000000000..2b15f24c7 --- /dev/null +++ b/test/integration/components/pythongrpc/Dockerfile_srv @@ -0,0 +1,11 @@ +# Dockerfile that will build a container that runs python with FastAPI and uvicorn on port 8080 +FROM python:3.12 +EXPOSE 50051 +RUN pip install grpcio grpcio_tools +COPY route_guide_server.py /route_guide_server.py +COPY route_guide_db.json /route_guide_db.json +COPY route_guide_pb2_grpc.py /route_guide_pb2_grpc.py +COPY route_guide_pb2.py /route_guide_pb2.py +COPY route_guide_pb2.pyi /route_guide_pb2.pyi +COPY route_guide_resources.py /route_guide_resources.py +CMD ["python", "route_guide_server.py"] \ No newline at end of file diff --git a/test/integration/components/pythongrpc/main.py b/test/integration/components/pythongrpc/main.py new file mode 100644 index 000000000..4fbeff1fd --- /dev/null +++ b/test/integration/components/pythongrpc/main.py @@ -0,0 +1,129 @@ +from __future__ import print_function +from fastapi import FastAPI +import os +import uvicorn + +import logging +import random +import time +import grpc +import route_guide_pb2 +import route_guide_pb2_grpc +import route_guide_resources + +app = FastAPI() + +channel = grpc.insecure_channel("grpcsrv:50051") +stub = route_guide_pb2_grpc.RouteGuideStub(channel) + +count = 0 + +def make_route_note(message, latitude, longitude): + return route_guide_pb2.RouteNote( + message=message, + location=route_guide_pb2.Point(latitude=latitude, longitude=longitude), + ) + + +def format_point(point): + # not delegating in point.__str__ because it is an empty string when its + # values are zero. In addition, it puts a newline between the fields. + return "latitude: %d, longitude: %d" % (point.latitude, point.longitude) + + +def guide_get_one_feature(stub, point): + feature = stub.GetFeature(point) + if not feature.location: + print("Server returned incomplete feature") + return + + if feature.name: + print( + "Feature called %r at %s" + % (feature.name, format_point(feature.location)) + ) + else: + print("Found no feature at %s" % format_point(feature.location)) + + +def guide_get_feature(stub): + guide_get_one_feature( + stub, route_guide_pb2.Point(latitude=409146138, longitude=-746188906) + ) + +def guide_list_features(stub): + rectangle = route_guide_pb2.Rectangle( + lo=route_guide_pb2.Point(latitude=400000000, longitude=-750000000), + hi=route_guide_pb2.Point(latitude=420000000, longitude=-730000000), + ) + print("Looking for features between 40, -75 and 42, -73") + + features = stub.ListFeatures(rectangle) + + for feature in features: + print( + "Feature called %r at %s" + % (feature.name, format_point(feature.location)) + ) + + +def generate_route(feature_list): + for _ in range(0, 10): + random_feature = random.choice(feature_list) + print("Visiting point %s" % format_point(random_feature.location)) + yield random_feature.location + + +def guide_record_route(stub): + feature_list = route_guide_resources.read_route_guide_database() + + route_iterator = generate_route(feature_list) + route_summary = stub.RecordRoute(route_iterator) + print("Finished trip with %s points " % route_summary.point_count) + print("Passed %s features " % route_summary.feature_count) + print("Travelled %s meters " % route_summary.distance) + print("It took %s seconds " % route_summary.elapsed_time) + + +def generate_messages(): + messages = [ + make_route_note("First message", 0, 0), + make_route_note("Second message", 0, 1), + make_route_note("Third message", 1, 0), + make_route_note("Fourth message", 0, 0), + make_route_note("Fifth message", 1, 0), + ] + for msg in messages: + print("Sending %s at %s" % (msg.message, format_point(msg.location))) + yield msg + + +def guide_route_chat(stub): + responses = stub.RouteChat(generate_messages()) + for response in responses: + print( + "Received message %s at %s" + % (response.message, format_point(response.location)) + ) + +@app.get("/query") +async def root(): + global channel + global stub + global count + + count = count + 1 + + # Reset from time to time in case Beyla started too late + if count > 5: + channel = grpc.insecure_channel("grpcsrv:50051") + stub = route_guide_pb2_grpc.RouteGuideStub(channel) + + guide_get_feature(stub) + + return "GRPC" + +if __name__ == "__main__": + print(f"Server running: port={8080} process_id={os.getpid()}") + + uvicorn.run(app, host="0.0.0.0", port=8080) \ No newline at end of file diff --git a/test/integration/components/pythongrpc/route_guide_db.json b/test/integration/components/pythongrpc/route_guide_db.json new file mode 100644 index 000000000..9d6a980ab --- /dev/null +++ b/test/integration/components/pythongrpc/route_guide_db.json @@ -0,0 +1,601 @@ +[{ + "location": { + "latitude": 407838351, + "longitude": -746143763 + }, + "name": "Patriots Path, Mendham, NJ 07945, USA" +}, { + "location": { + "latitude": 408122808, + "longitude": -743999179 + }, + "name": "101 New Jersey 10, Whippany, NJ 07981, USA" +}, { + "location": { + "latitude": 413628156, + "longitude": -749015468 + }, + "name": "U.S. 6, Shohola, PA 18458, USA" +}, { + "location": { + "latitude": 419999544, + "longitude": -740371136 + }, + "name": "5 Conners Road, Kingston, NY 12401, USA" +}, { + "location": { + "latitude": 414008389, + "longitude": -743951297 + }, + "name": "Mid Hudson Psychiatric Center, New Hampton, NY 10958, USA" +}, { + "location": { + "latitude": 419611318, + "longitude": -746524769 + }, + "name": "287 Flugertown Road, Livingston Manor, NY 12758, USA" +}, { + "location": { + "latitude": 406109563, + "longitude": -742186778 + }, + "name": "4001 Tremley Point Road, Linden, NJ 07036, USA" +}, { + "location": { + "latitude": 416802456, + "longitude": -742370183 + }, + "name": "352 South Mountain Road, Wallkill, NY 12589, USA" +}, { + "location": { + "latitude": 412950425, + "longitude": -741077389 + }, + "name": "Bailey Turn Road, Harriman, NY 10926, USA" +}, { + "location": { + "latitude": 412144655, + "longitude": -743949739 + }, + "name": "193-199 Wawayanda Road, Hewitt, NJ 07421, USA" +}, { + "location": { + "latitude": 415736605, + "longitude": -742847522 + }, + "name": "406-496 Ward Avenue, Pine Bush, NY 12566, USA" +}, { + "location": { + "latitude": 413843930, + "longitude": -740501726 + }, + "name": "162 Merrill Road, Highland Mills, NY 10930, USA" +}, { + "location": { + "latitude": 410873075, + "longitude": -744459023 + }, + "name": "Clinton Road, West Milford, NJ 07480, USA" +}, { + "location": { + "latitude": 412346009, + "longitude": -744026814 + }, + "name": "16 Old Brook Lane, Warwick, NY 10990, USA" +}, { + "location": { + "latitude": 402948455, + "longitude": -747903913 + }, + "name": "3 Drake Lane, Pennington, NJ 08534, USA" +}, { + "location": { + "latitude": 406337092, + "longitude": -740122226 + }, + "name": "6324 8th Avenue, Brooklyn, NY 11220, USA" +}, { + "location": { + "latitude": 406421967, + "longitude": -747727624 + }, + "name": "1 Merck Access Road, Whitehouse Station, NJ 08889, USA" +}, { + "location": { + "latitude": 416318082, + "longitude": -749677716 + }, + "name": "78-98 Schalck Road, Narrowsburg, NY 12764, USA" +}, { + "location": { + "latitude": 415301720, + "longitude": -748416257 + }, + "name": "282 Lakeview Drive Road, Highland Lake, NY 12743, USA" +}, { + "location": { + "latitude": 402647019, + "longitude": -747071791 + }, + "name": "330 Evelyn Avenue, Hamilton Township, NJ 08619, USA" +}, { + "location": { + "latitude": 412567807, + "longitude": -741058078 + }, + "name": "New York State Reference Route 987E, Southfields, NY 10975, USA" +}, { + "location": { + "latitude": 416855156, + "longitude": -744420597 + }, + "name": "103-271 Tempaloni Road, Ellenville, NY 12428, USA" +}, { + "location": { + "latitude": 404663628, + "longitude": -744820157 + }, + "name": "1300 Airport Road, North Brunswick Township, NJ 08902, USA" +}, { + "location": { + "latitude": 407113723, + "longitude": -749746483 + }, + "name": "" +}, { + "location": { + "latitude": 402133926, + "longitude": -743613249 + }, + "name": "" +}, { + "location": { + "latitude": 400273442, + "longitude": -741220915 + }, + "name": "" +}, { + "location": { + "latitude": 411236786, + "longitude": -744070769 + }, + "name": "" +}, { + "location": { + "latitude": 411633782, + "longitude": -746784970 + }, + "name": "211-225 Plains Road, Augusta, NJ 07822, USA" +}, { + "location": { + "latitude": 415830701, + "longitude": -742952812 + }, + "name": "" +}, { + "location": { + "latitude": 413447164, + "longitude": -748712898 + }, + "name": "165 Pedersen Ridge Road, Milford, PA 18337, USA" +}, { + "location": { + "latitude": 405047245, + "longitude": -749800722 + }, + "name": "100-122 Locktown Road, Frenchtown, NJ 08825, USA" +}, { + "location": { + "latitude": 418858923, + "longitude": -746156790 + }, + "name": "" +}, { + "location": { + "latitude": 417951888, + "longitude": -748484944 + }, + "name": "650-652 Willi Hill Road, Swan Lake, NY 12783, USA" +}, { + "location": { + "latitude": 407033786, + "longitude": -743977337 + }, + "name": "26 East 3rd Street, New Providence, NJ 07974, USA" +}, { + "location": { + "latitude": 417548014, + "longitude": -740075041 + }, + "name": "" +}, { + "location": { + "latitude": 410395868, + "longitude": -744972325 + }, + "name": "" +}, { + "location": { + "latitude": 404615353, + "longitude": -745129803 + }, + "name": "" +}, { + "location": { + "latitude": 406589790, + "longitude": -743560121 + }, + "name": "611 Lawrence Avenue, Westfield, NJ 07090, USA" +}, { + "location": { + "latitude": 414653148, + "longitude": -740477477 + }, + "name": "18 Lannis Avenue, New Windsor, NY 12553, USA" +}, { + "location": { + "latitude": 405957808, + "longitude": -743255336 + }, + "name": "82-104 Amherst Avenue, Colonia, NJ 07067, USA" +}, { + "location": { + "latitude": 411733589, + "longitude": -741648093 + }, + "name": "170 Seven Lakes Drive, Sloatsburg, NY 10974, USA" +}, { + "location": { + "latitude": 412676291, + "longitude": -742606606 + }, + "name": "1270 Lakes Road, Monroe, NY 10950, USA" +}, { + "location": { + "latitude": 409224445, + "longitude": -748286738 + }, + "name": "509-535 Alphano Road, Great Meadows, NJ 07838, USA" +}, { + "location": { + "latitude": 406523420, + "longitude": -742135517 + }, + "name": "652 Garden Street, Elizabeth, NJ 07202, USA" +}, { + "location": { + "latitude": 401827388, + "longitude": -740294537 + }, + "name": "349 Sea Spray Court, Neptune City, NJ 07753, USA" +}, { + "location": { + "latitude": 410564152, + "longitude": -743685054 + }, + "name": "13-17 Stanley Street, West Milford, NJ 07480, USA" +}, { + "location": { + "latitude": 408472324, + "longitude": -740726046 + }, + "name": "47 Industrial Avenue, Teterboro, NJ 07608, USA" +}, { + "location": { + "latitude": 412452168, + "longitude": -740214052 + }, + "name": "5 White Oak Lane, Stony Point, NY 10980, USA" +}, { + "location": { + "latitude": 409146138, + "longitude": -746188906 + }, + "name": "Berkshire Valley Management Area Trail, Jefferson, NJ, USA" +}, { + "location": { + "latitude": 404701380, + "longitude": -744781745 + }, + "name": "1007 Jersey Avenue, New Brunswick, NJ 08901, USA" +}, { + "location": { + "latitude": 409642566, + "longitude": -746017679 + }, + "name": "6 East Emerald Isle Drive, Lake Hopatcong, NJ 07849, USA" +}, { + "location": { + "latitude": 408031728, + "longitude": -748645385 + }, + "name": "1358-1474 New Jersey 57, Port Murray, NJ 07865, USA" +}, { + "location": { + "latitude": 413700272, + "longitude": -742135189 + }, + "name": "367 Prospect Road, Chester, NY 10918, USA" +}, { + "location": { + "latitude": 404310607, + "longitude": -740282632 + }, + "name": "10 Simon Lake Drive, Atlantic Highlands, NJ 07716, USA" +}, { + "location": { + "latitude": 409319800, + "longitude": -746201391 + }, + "name": "11 Ward Street, Mount Arlington, NJ 07856, USA" +}, { + "location": { + "latitude": 406685311, + "longitude": -742108603 + }, + "name": "300-398 Jefferson Avenue, Elizabeth, NJ 07201, USA" +}, { + "location": { + "latitude": 419018117, + "longitude": -749142781 + }, + "name": "43 Dreher Road, Roscoe, NY 12776, USA" +}, { + "location": { + "latitude": 412856162, + "longitude": -745148837 + }, + "name": "Swan Street, Pine Island, NY 10969, USA" +}, { + "location": { + "latitude": 416560744, + "longitude": -746721964 + }, + "name": "66 Pleasantview Avenue, Monticello, NY 12701, USA" +}, { + "location": { + "latitude": 405314270, + "longitude": -749836354 + }, + "name": "" +}, { + "location": { + "latitude": 414219548, + "longitude": -743327440 + }, + "name": "" +}, { + "location": { + "latitude": 415534177, + "longitude": -742900616 + }, + "name": "565 Winding Hills Road, Montgomery, NY 12549, USA" +}, { + "location": { + "latitude": 406898530, + "longitude": -749127080 + }, + "name": "231 Rocky Run Road, Glen Gardner, NJ 08826, USA" +}, { + "location": { + "latitude": 407586880, + "longitude": -741670168 + }, + "name": "100 Mount Pleasant Avenue, Newark, NJ 07104, USA" +}, { + "location": { + "latitude": 400106455, + "longitude": -742870190 + }, + "name": "517-521 Huntington Drive, Manchester Township, NJ 08759, USA" +}, { + "location": { + "latitude": 400066188, + "longitude": -746793294 + }, + "name": "" +}, { + "location": { + "latitude": 418803880, + "longitude": -744102673 + }, + "name": "40 Mountain Road, Napanoch, NY 12458, USA" +}, { + "location": { + "latitude": 414204288, + "longitude": -747895140 + }, + "name": "" +}, { + "location": { + "latitude": 414777405, + "longitude": -740615601 + }, + "name": "" +}, { + "location": { + "latitude": 415464475, + "longitude": -747175374 + }, + "name": "48 North Road, Forestburgh, NY 12777, USA" +}, { + "location": { + "latitude": 404062378, + "longitude": -746376177 + }, + "name": "" +}, { + "location": { + "latitude": 405688272, + "longitude": -749285130 + }, + "name": "" +}, { + "location": { + "latitude": 400342070, + "longitude": -748788996 + }, + "name": "" +}, { + "location": { + "latitude": 401809022, + "longitude": -744157964 + }, + "name": "" +}, { + "location": { + "latitude": 404226644, + "longitude": -740517141 + }, + "name": "9 Thompson Avenue, Leonardo, NJ 07737, USA" +}, { + "location": { + "latitude": 410322033, + "longitude": -747871659 + }, + "name": "" +}, { + "location": { + "latitude": 407100674, + "longitude": -747742727 + }, + "name": "" +}, { + "location": { + "latitude": 418811433, + "longitude": -741718005 + }, + "name": "213 Bush Road, Stone Ridge, NY 12484, USA" +}, { + "location": { + "latitude": 415034302, + "longitude": -743850945 + }, + "name": "" +}, { + "location": { + "latitude": 411349992, + "longitude": -743694161 + }, + "name": "" +}, { + "location": { + "latitude": 404839914, + "longitude": -744759616 + }, + "name": "1-17 Bergen Court, New Brunswick, NJ 08901, USA" +}, { + "location": { + "latitude": 414638017, + "longitude": -745957854 + }, + "name": "35 Oakland Valley Road, Cuddebackville, NY 12729, USA" +}, { + "location": { + "latitude": 412127800, + "longitude": -740173578 + }, + "name": "" +}, { + "location": { + "latitude": 401263460, + "longitude": -747964303 + }, + "name": "" +}, { + "location": { + "latitude": 412843391, + "longitude": -749086026 + }, + "name": "" +}, { + "location": { + "latitude": 418512773, + "longitude": -743067823 + }, + "name": "" +}, { + "location": { + "latitude": 404318328, + "longitude": -740835638 + }, + "name": "42-102 Main Street, Belford, NJ 07718, USA" +}, { + "location": { + "latitude": 419020746, + "longitude": -741172328 + }, + "name": "" +}, { + "location": { + "latitude": 404080723, + "longitude": -746119569 + }, + "name": "" +}, { + "location": { + "latitude": 401012643, + "longitude": -744035134 + }, + "name": "" +}, { + "location": { + "latitude": 404306372, + "longitude": -741079661 + }, + "name": "" +}, { + "location": { + "latitude": 403966326, + "longitude": -748519297 + }, + "name": "" +}, { + "location": { + "latitude": 405002031, + "longitude": -748407866 + }, + "name": "" +}, { + "location": { + "latitude": 409532885, + "longitude": -742200683 + }, + "name": "" +}, { + "location": { + "latitude": 416851321, + "longitude": -742674555 + }, + "name": "" +}, { + "location": { + "latitude": 406411633, + "longitude": -741722051 + }, + "name": "3387 Richmond Terrace, Staten Island, NY 10303, USA" +}, { + "location": { + "latitude": 413069058, + "longitude": -744597778 + }, + "name": "261 Van Sickle Road, Goshen, NY 10924, USA" +}, { + "location": { + "latitude": 418465462, + "longitude": -746859398 + }, + "name": "" +}, { + "location": { + "latitude": 411733222, + "longitude": -744228360 + }, + "name": "" +}, { + "location": { + "latitude": 410248224, + "longitude": -747127767 + }, + "name": "3 Hasta Way, Newton, NJ 07860, USA" +}] diff --git a/test/integration/components/pythongrpc/route_guide_pb2.py b/test/integration/components/pythongrpc/route_guide_pb2.py new file mode 100644 index 000000000..8916cc0dc --- /dev/null +++ b/test/integration/components/pythongrpc/route_guide_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: route_guide.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11route_guide.proto\x12\nrouteguide\",\n\x05Point\x12\x10\n\x08latitude\x18\x01 \x01(\x05\x12\x11\n\tlongitude\x18\x02 \x01(\x05\"I\n\tRectangle\x12\x1d\n\x02lo\x18\x01 \x01(\x0b\x32\x11.routeguide.Point\x12\x1d\n\x02hi\x18\x02 \x01(\x0b\x32\x11.routeguide.Point\"<\n\x07\x46\x65\x61ture\x12\x0c\n\x04name\x18\x01 \x01(\t\x12#\n\x08location\x18\x02 \x01(\x0b\x32\x11.routeguide.Point\"A\n\tRouteNote\x12#\n\x08location\x18\x01 \x01(\x0b\x32\x11.routeguide.Point\x12\x0f\n\x07message\x18\x02 \x01(\t\"b\n\x0cRouteSummary\x12\x13\n\x0bpoint_count\x18\x01 \x01(\x05\x12\x15\n\rfeature_count\x18\x02 \x01(\x05\x12\x10\n\x08\x64istance\x18\x03 \x01(\x05\x12\x14\n\x0c\x65lapsed_time\x18\x04 \x01(\x05\x32\x85\x02\n\nRouteGuide\x12\x36\n\nGetFeature\x12\x11.routeguide.Point\x1a\x13.routeguide.Feature\"\x00\x12>\n\x0cListFeatures\x12\x15.routeguide.Rectangle\x1a\x13.routeguide.Feature\"\x00\x30\x01\x12>\n\x0bRecordRoute\x12\x11.routeguide.Point\x1a\x18.routeguide.RouteSummary\"\x00(\x01\x12?\n\tRouteChat\x12\x15.routeguide.RouteNote\x1a\x15.routeguide.RouteNote\"\x00(\x01\x30\x01\x42\x36\n\x1bio.grpc.examples.routeguideB\x0fRouteGuideProtoP\x01\xa2\x02\x03RTGb\x06proto3') + +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'route_guide_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\033io.grpc.examples.routeguideB\017RouteGuideProtoP\001\242\002\003RTG' + _POINT._serialized_start=33 + _POINT._serialized_end=77 + _RECTANGLE._serialized_start=79 + _RECTANGLE._serialized_end=152 + _FEATURE._serialized_start=154 + _FEATURE._serialized_end=214 + _ROUTENOTE._serialized_start=216 + _ROUTENOTE._serialized_end=281 + _ROUTESUMMARY._serialized_start=283 + _ROUTESUMMARY._serialized_end=381 + _ROUTEGUIDE._serialized_start=384 + _ROUTEGUIDE._serialized_end=645 +# @@protoc_insertion_point(module_scope) diff --git a/test/integration/components/pythongrpc/route_guide_pb2.pyi b/test/integration/components/pythongrpc/route_guide_pb2.pyi new file mode 100644 index 000000000..3f0064fef --- /dev/null +++ b/test/integration/components/pythongrpc/route_guide_pb2.pyi @@ -0,0 +1,49 @@ +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class Feature(_message.Message): + __slots__ = ["location", "name"] + LOCATION_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + location: Point + name: str + def __init__(self, name: _Optional[str] = ..., location: _Optional[_Union[Point, _Mapping]] = ...) -> None: ... + +class Point(_message.Message): + __slots__ = ["latitude", "longitude"] + LATITUDE_FIELD_NUMBER: _ClassVar[int] + LONGITUDE_FIELD_NUMBER: _ClassVar[int] + latitude: int + longitude: int + def __init__(self, latitude: _Optional[int] = ..., longitude: _Optional[int] = ...) -> None: ... + +class Rectangle(_message.Message): + __slots__ = ["hi", "lo"] + HI_FIELD_NUMBER: _ClassVar[int] + LO_FIELD_NUMBER: _ClassVar[int] + hi: Point + lo: Point + def __init__(self, lo: _Optional[_Union[Point, _Mapping]] = ..., hi: _Optional[_Union[Point, _Mapping]] = ...) -> None: ... + +class RouteNote(_message.Message): + __slots__ = ["location", "message"] + LOCATION_FIELD_NUMBER: _ClassVar[int] + MESSAGE_FIELD_NUMBER: _ClassVar[int] + location: Point + message: str + def __init__(self, location: _Optional[_Union[Point, _Mapping]] = ..., message: _Optional[str] = ...) -> None: ... + +class RouteSummary(_message.Message): + __slots__ = ["distance", "elapsed_time", "feature_count", "point_count"] + DISTANCE_FIELD_NUMBER: _ClassVar[int] + ELAPSED_TIME_FIELD_NUMBER: _ClassVar[int] + FEATURE_COUNT_FIELD_NUMBER: _ClassVar[int] + POINT_COUNT_FIELD_NUMBER: _ClassVar[int] + distance: int + elapsed_time: int + feature_count: int + point_count: int + def __init__(self, point_count: _Optional[int] = ..., feature_count: _Optional[int] = ..., distance: _Optional[int] = ..., elapsed_time: _Optional[int] = ...) -> None: ... diff --git a/test/integration/components/pythongrpc/route_guide_pb2_grpc.py b/test/integration/components/pythongrpc/route_guide_pb2_grpc.py new file mode 100644 index 000000000..3641d2e07 --- /dev/null +++ b/test/integration/components/pythongrpc/route_guide_pb2_grpc.py @@ -0,0 +1,188 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +import route_guide_pb2 as route__guide__pb2 + + +class RouteGuideStub(object): + """Interface exported by the server. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetFeature = channel.unary_unary( + '/routeguide.RouteGuide/GetFeature', + request_serializer=route__guide__pb2.Point.SerializeToString, + response_deserializer=route__guide__pb2.Feature.FromString, + ) + self.ListFeatures = channel.unary_stream( + '/routeguide.RouteGuide/ListFeatures', + request_serializer=route__guide__pb2.Rectangle.SerializeToString, + response_deserializer=route__guide__pb2.Feature.FromString, + ) + self.RecordRoute = channel.stream_unary( + '/routeguide.RouteGuide/RecordRoute', + request_serializer=route__guide__pb2.Point.SerializeToString, + response_deserializer=route__guide__pb2.RouteSummary.FromString, + ) + self.RouteChat = channel.stream_stream( + '/routeguide.RouteGuide/RouteChat', + request_serializer=route__guide__pb2.RouteNote.SerializeToString, + response_deserializer=route__guide__pb2.RouteNote.FromString, + ) + + +class RouteGuideServicer(object): + """Interface exported by the server. + """ + + def GetFeature(self, request, context): + """A simple RPC. + + Obtains the feature at a given position. + + A feature with an empty name is returned if there's no feature at the given + position. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ListFeatures(self, request, context): + """A server-to-client streaming RPC. + + Obtains the Features available within the given Rectangle. Results are + streamed rather than returned at once (e.g. in a response message with a + repeated field), as the rectangle may cover a large area and contain a + huge number of features. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RecordRoute(self, request_iterator, context): + """A client-to-server streaming RPC. + + Accepts a stream of Points on a route being traversed, returning a + RouteSummary when traversal is completed. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RouteChat(self, request_iterator, context): + """A Bidirectional streaming RPC. + + Accepts a stream of RouteNotes sent while a route is being traversed, + while receiving other RouteNotes (e.g. from other users). + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_RouteGuideServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GetFeature': grpc.unary_unary_rpc_method_handler( + servicer.GetFeature, + request_deserializer=route__guide__pb2.Point.FromString, + response_serializer=route__guide__pb2.Feature.SerializeToString, + ), + 'ListFeatures': grpc.unary_stream_rpc_method_handler( + servicer.ListFeatures, + request_deserializer=route__guide__pb2.Rectangle.FromString, + response_serializer=route__guide__pb2.Feature.SerializeToString, + ), + 'RecordRoute': grpc.stream_unary_rpc_method_handler( + servicer.RecordRoute, + request_deserializer=route__guide__pb2.Point.FromString, + response_serializer=route__guide__pb2.RouteSummary.SerializeToString, + ), + 'RouteChat': grpc.stream_stream_rpc_method_handler( + servicer.RouteChat, + request_deserializer=route__guide__pb2.RouteNote.FromString, + response_serializer=route__guide__pb2.RouteNote.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'routeguide.RouteGuide', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class RouteGuide(object): + """Interface exported by the server. + """ + + @staticmethod + def GetFeature(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/routeguide.RouteGuide/GetFeature', + route__guide__pb2.Point.SerializeToString, + route__guide__pb2.Feature.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ListFeatures(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/routeguide.RouteGuide/ListFeatures', + route__guide__pb2.Rectangle.SerializeToString, + route__guide__pb2.Feature.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def RecordRoute(request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_unary(request_iterator, target, '/routeguide.RouteGuide/RecordRoute', + route__guide__pb2.Point.SerializeToString, + route__guide__pb2.RouteSummary.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def RouteChat(request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_stream(request_iterator, target, '/routeguide.RouteGuide/RouteChat', + route__guide__pb2.RouteNote.SerializeToString, + route__guide__pb2.RouteNote.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/test/integration/components/pythongrpc/route_guide_resources.py b/test/integration/components/pythongrpc/route_guide_resources.py new file mode 100644 index 000000000..7cee03ada --- /dev/null +++ b/test/integration/components/pythongrpc/route_guide_resources.py @@ -0,0 +1,39 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Common resources used in the gRPC route guide example.""" + +import json + +import route_guide_pb2 + + +def read_route_guide_database(): + """Reads the route guide database. + + Returns: + The full contents of the route guide database as a sequence of + route_guide_pb2.Features. + """ + feature_list = [] + with open("route_guide_db.json") as route_guide_db_file: + for item in json.load(route_guide_db_file): + feature = route_guide_pb2.Feature( + name=item["name"], + location=route_guide_pb2.Point( + latitude=item["location"]["latitude"], + longitude=item["location"]["longitude"], + ), + ) + feature_list.append(feature) + return feature_list diff --git a/test/integration/components/pythongrpc/route_guide_server.py b/test/integration/components/pythongrpc/route_guide_server.py new file mode 100644 index 000000000..5879ddab0 --- /dev/null +++ b/test/integration/components/pythongrpc/route_guide_server.py @@ -0,0 +1,130 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The Python implementation of the gRPC route guide server.""" + +from concurrent import futures +import logging +import math +import time + +import grpc +import route_guide_pb2 +import route_guide_pb2_grpc +import route_guide_resources + + +def get_feature(feature_db, point): + """Returns Feature at given location or None.""" + for feature in feature_db: + if feature.location == point: + return feature + return None + + +def get_distance(start, end): + """Distance between two points.""" + coord_factor = 10000000.0 + lat_1 = start.latitude / coord_factor + lat_2 = end.latitude / coord_factor + lon_1 = start.longitude / coord_factor + lon_2 = end.longitude / coord_factor + lat_rad_1 = math.radians(lat_1) + lat_rad_2 = math.radians(lat_2) + delta_lat_rad = math.radians(lat_2 - lat_1) + delta_lon_rad = math.radians(lon_2 - lon_1) + + # Formula is based on http://mathforum.org/library/drmath/view/51879.html + a = pow(math.sin(delta_lat_rad / 2), 2) + ( + math.cos(lat_rad_1) + * math.cos(lat_rad_2) + * pow(math.sin(delta_lon_rad / 2), 2) + ) + c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a)) + R = 6371000 + # metres + return R * c + + +class RouteGuideServicer(route_guide_pb2_grpc.RouteGuideServicer): + """Provides methods that implement functionality of route guide server.""" + + def __init__(self): + self.db = route_guide_resources.read_route_guide_database() + + def GetFeature(self, request, context): + feature = get_feature(self.db, request) + if feature is None: + return route_guide_pb2.Feature(name="", location=request) + else: + return feature + + def ListFeatures(self, request, context): + left = min(request.lo.longitude, request.hi.longitude) + right = max(request.lo.longitude, request.hi.longitude) + top = max(request.lo.latitude, request.hi.latitude) + bottom = min(request.lo.latitude, request.hi.latitude) + for feature in self.db: + if ( + feature.location.longitude >= left + and feature.location.longitude <= right + and feature.location.latitude >= bottom + and feature.location.latitude <= top + ): + yield feature + + def RecordRoute(self, request_iterator, context): + point_count = 0 + feature_count = 0 + distance = 0.0 + prev_point = None + + start_time = time.time() + for point in request_iterator: + point_count += 1 + if get_feature(self.db, point): + feature_count += 1 + if prev_point: + distance += get_distance(prev_point, point) + prev_point = point + + elapsed_time = time.time() - start_time + return route_guide_pb2.RouteSummary( + point_count=point_count, + feature_count=feature_count, + distance=int(distance), + elapsed_time=int(elapsed_time), + ) + + def RouteChat(self, request_iterator, context): + prev_notes = [] + for new_note in request_iterator: + for prev_note in prev_notes: + if prev_note.location == new_note.location: + yield prev_note + prev_notes.append(new_note) + + +def serve(): + server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) + route_guide_pb2_grpc.add_RouteGuideServicer_to_server( + RouteGuideServicer(), server + ) + server.add_insecure_port("0.0.0.0:50051") + server.start() + server.wait_for_termination() + + +if __name__ == "__main__": + logging.basicConfig() + serve() diff --git a/test/oats/http/configs/grafana-datasources.yaml b/test/oats/http/configs/grafana-datasources.yaml new file mode 100644 index 000000000..c7b118ad5 --- /dev/null +++ b/test/oats/http/configs/grafana-datasources.yaml @@ -0,0 +1,41 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + uid: prometheus + url: http://prometheus:9090 + jsonData: + exemplarTraceIdDestinations: + - name: trace_id + datasourceUid: tempo + + - name: Tempo + type: tempo + uid: tempo + url: http://tempo:3200 + jsonData: + tracesToLogs: + datasourceUid: 'loki' + mappedTags: [{ key: 'service.name', value: 'job' }] + mapTagNamesEnabled: true + filterByTraceID: true + serviceMap: + datasourceUid: 'prometheus' + search: + hide: false + nodeGraph: + enabled: true + lokiSearch: + datasourceUid: 'loki' + + - name: Loki + type: loki + uid: loki + url: http://loki:3100 + jsonData: + derivedFields: + - name: 'trace_id' + matcherRegex: '"traceid":"(\w+)"' + url: '$${__value.raw}' + datasourceUid: 'tempo' diff --git a/test/oats/http/configs/instrumenter-config-python-grpc.yml b/test/oats/http/configs/instrumenter-config-python-grpc.yml new file mode 100644 index 000000000..cba93d2da --- /dev/null +++ b/test/oats/http/configs/instrumenter-config-python-grpc.yml @@ -0,0 +1,9 @@ +discovery: + services: + - namespace: grpc-python + name: grpcsrv + open_ports: 50051 + - namespace: grpc-python + name: testserver + open_ports: 8080 + \ No newline at end of file diff --git a/test/oats/http/configs/otelcol-config.yaml b/test/oats/http/configs/otelcol-config.yaml new file mode 100644 index 000000000..b830bc605 --- /dev/null +++ b/test/oats/http/configs/otelcol-config.yaml @@ -0,0 +1,43 @@ +receivers: + otlp: + protocols: + grpc: + http: + +processors: + batch: + +exporters: + prometheusremotewrite: + endpoint: http://prometheus:9090/api/v1/write + add_metric_suffixes: true + otlp: + endpoint: tempo:4317 + tls: + insecure: true + loki: + endpoint: http://loki:3100/loki/api/v1/push + logging/metrics: + verbosity: detailed + logging/traces: + verbosity: detailed + logging/logs: + verbosity: detailed + +service: + pipelines: + traces: + receivers: [otlp] + processors: [batch] + #exporters: [otlp] + exporters: [otlp,logging/traces] + metrics: + receivers: [otlp] + processors: [batch] + exporters: [prometheusremotewrite] + #exporters: [prometheusremotewrite,logging/metrics] + logs: + receivers: [otlp] + processors: [batch] + exporters: [loki] + #exporters: [loki,logging/logs] diff --git a/test/oats/http/configs/prometheus-config.yml b/test/oats/http/configs/prometheus-config.yml new file mode 100644 index 000000000..cc4215ccc --- /dev/null +++ b/test/oats/http/configs/prometheus-config.yml @@ -0,0 +1,13 @@ +global: + evaluation_interval: 30s + scrape_interval: 5s +scrape_configs: + - job_name: otel + honor_labels: true + static_configs: + - targets: + - 'otelcol:9464' + - job_name: otel-collector + static_configs: + - targets: + - 'otelcol:8888' diff --git a/test/oats/http/configs/tempo-config.yaml b/test/oats/http/configs/tempo-config.yaml new file mode 100644 index 000000000..392dbaf4d --- /dev/null +++ b/test/oats/http/configs/tempo-config.yaml @@ -0,0 +1,27 @@ +server: + http_listen_port: 3200 + grpc_listen_port: 9096 + +distributor: + receivers: + otlp: + protocols: + grpc: + +storage: + trace: + backend: local + wal: + path: /tmp/tempo/wal + local: + path: /tmp/tempo/blocks + +#metrics_generator: +# storage: +# path: /tmp/tempo/generator/wal +# remote_write: +# - url: http://localhost:9090/api/v1/write +# send_exemplars: true + +#overrides: +# metrics_generator_processors: [span-metrics] diff --git a/test/oats/http/docker-compose-beyla-python-grpc.yml b/test/oats/http/docker-compose-beyla-python-grpc.yml new file mode 100644 index 000000000..a9d0c7b40 --- /dev/null +++ b/test/oats/http/docker-compose-beyla-python-grpc.yml @@ -0,0 +1,47 @@ +services: + # GRPC server + grpcsrv: + build: + context: ../../integration/components/pythongrpc + dockerfile: Dockerfile_srv + image: grpcsrv + ports: + - "50051:50051" + # Simple python HTTP server, which exposes one endpoint /query that calls the GRPC server + testserver: + build: + context: ../../integration/components/pythongrpc + dockerfile: Dockerfile + image: grpclient + ports: + - "8080:8080" + depends_on: + autoinstrumenter: + condition: service_started + # eBPF auto instrumenter + autoinstrumenter: + build: + context: ../../.. + dockerfile: ./test/integration/components/beyla/Dockerfile + command: + - --config=/configs/instrumenter-config-python-grpc.yml + volumes: + - {{ .ConfigDir }}:/configs + - ./testoutput/run:/var/run/beyla + - ../../../testoutput:/coverage + privileged: true # in some environments (not GH Pull Requests) you can set it to false and then cap_add: [ SYS_ADMIN ] + network_mode: "service:grpcsrv" + pid: "service:grpcsrv" + environment: + GOCOVERDIR: "/coverage" + BEYLA_TRACE_PRINTER: "text" + BEYLA_OPEN_PORT: {{ .ApplicationPort }} + BEYLA_SERVICE_NAMESPACE: "integration-test" + BEYLA_METRICS_INTERVAL: "10ms" + BEYLA_BPF_BATCH_TIMEOUT: "10ms" + BEYLA_LOG_LEVEL: "DEBUG" + BEYLA_BPF_DEBUG: "true" + OTEL_EXPORTER_OTLP_ENDPOINT: "http://collector:4318" + depends_on: + grpcsrv: + condition: service_started diff --git a/test/oats/http/docker-compose-generic-template.yml b/test/oats/http/docker-compose-generic-template.yml new file mode 100644 index 000000000..f1eebca3f --- /dev/null +++ b/test/oats/http/docker-compose-generic-template.yml @@ -0,0 +1,37 @@ +version: "3.9" +services: + grafana: + image: grafana/grafana:10.0.5 + volumes: + - "{{ .ConfigDir }}/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/grafana-datasources.yaml" + ports: + - "{{ .GrafanaHTTPPort }}:3000" + prometheus: + image: prom/prometheus:v2.47.0 + command: + - --web.enable-remote-write-receiver + - --enable-feature=exemplar-storage + - --enable-feature=native-histograms + - --config.file=/etc/prometheus/prometheus.yml + ports: + - "{{ .PrometheusHTTPPort }}:9090" + tempo: + image: grafana/tempo:2.2.3 + volumes: + - "{{ .ConfigDir }}/tempo-config.yaml:/config.yaml" + command: + - --config.file=/config.yaml + ports: + - "{{ .TempoHTTPPort }}:3200" +# loki: +# image: grafana/loki:2.9.0 +# ports: +# - "{{ .LokiHTTPPort }}:3100" + collector: + image: otel/opentelemetry-collector-contrib:0.103.0 + volumes: + - "{{ .ConfigDir }}/otelcol-config.yaml:/config.yaml" + command: + - --config=file:/config.yaml + # we currently don't support this in our dashboards and grafana agent doesn't understand it yet + - --feature-gates=-pkg.translator.prometheus.NormalizeName diff --git a/test/oats/http/docker-compose-include-base.yml b/test/oats/http/docker-compose-include-base.yml new file mode 100644 index 000000000..7a3f4b3e8 --- /dev/null +++ b/test/oats/http/docker-compose-include-base.yml @@ -0,0 +1,3 @@ +include: +{{ range .files }}- {{ . }} +{{ end }} diff --git a/test/oats/http/go.mod b/test/oats/http/go.mod new file mode 100644 index 000000000..cdb03db41 --- /dev/null +++ b/test/oats/http/go.mod @@ -0,0 +1,55 @@ +module github.com/grafana/beyla/test/oats + +go 1.23 + +require ( + github.com/grafana/oats v0.0.3 + github.com/onsi/ginkgo/v2 v2.19.0 + github.com/onsi/gomega v1.33.1 +) + +require ( + 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/dennwc/varint v1.0.0 // indirect + github.com/go-kit/log v0.2.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect + github.com/grafana/dashboard-linter v0.0.0-20240605160358-bb0d80454a01 // indirect + github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.54.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + github.com/prometheus/prometheus v0.52.1 // indirect + go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/otel v1.27.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/metric v1.27.0 // indirect + go.opentelemetry.io/otel/sdk v1.27.0 // indirect + go.opentelemetry.io/otel/trace v1.27.0 // indirect + go.opentelemetry.io/proto/otlp v1.2.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.22.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/grpc v1.64.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/test/oats/http/go.sum b/test/oats/http/go.sum new file mode 100644 index 000000000..738194321 --- /dev/null +++ b/test/oats/http/go.sum @@ -0,0 +1,203 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 h1:FDif4R1+UUR+00q6wquyX90K7A8dN+R5E8GEadoP7sU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2/go.mod h1:aiYBYui4BJ/BJCAIKs92XiPyQfTaBWqvHujDwKb6CBU= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 h1:ez/4by2iGztzR4L0zgAOR8lTQK9VlyBVVd7G4omaOQs= +github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/aws/aws-sdk-go v1.51.25 h1:DjTT8mtmsachhV6yrXR8+yhnG6120dazr720nopRsls= +github.com/aws/aws-sdk-go v1.51.25/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 h1:6df1vn4bBlDDo4tARvBm7l6KA9iVMnE3NWizDeWSrps= +github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3/go.mod h1:CIWtjkly68+yqLPbvwwR/fjNJA/idrtULjZWh2v1ys0= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dennwc/varint v1.0.0 h1:kGNFFSSw8ToIy3obO/kKr8U9GZYUAxQEVuix4zfDWzE= +github.com/dennwc/varint v1.0.0/go.mod h1:hnItb35rvZvJrbTALZtY/iQfDs48JKRG1RPpgziApxA= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20240528025155-186aa0362fba h1:ql1qNgCyOB7iAEk8JTNM+zJrgIbnyCKX/wdlyPufP5g= +github.com/google/pprof v0.0.0-20240528025155-186aa0362fba/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grafana/dashboard-linter v0.0.0-20240605160358-bb0d80454a01 h1:bHq9v1NEqrrrfSl448klKqd2t7qz/ksa4j0xt8TZ4NI= +github.com/grafana/dashboard-linter v0.0.0-20240605160358-bb0d80454a01/go.mod h1:h5Kxj4zO2fTDgq8eXuNXxxDptf0kkqRt/dOliWtbQJg= +github.com/grafana/oats v0.0.3 h1:BK0awL9jWRpTzj/ulA7Y6CEPmduXxc1g3QcNUd7jfNk= +github.com/grafana/oats v0.0.3/go.mod h1:UyGwRG0LMYy6EEgakuiEB7NdIHkBzKhXhRPi+ek85J4= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= +github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= +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/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.54.0 h1:ZlZy0BgJhTwVZUn7dLOkwCZHUkrAqd3WYtcFCWnM1D8= +github.com/prometheus/common v0.54.0/go.mod h1:/TQgMJP5CuVYveyT7n/0Ix8yLNNXy9yRSkhnLTHPDIQ= +github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= +github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/prometheus/prometheus v0.52.1 h1:BrQ29YG+mzdGh8DgHPirHbeMGNqtL+INe0rqg7ttBJ4= +github.com/prometheus/prometheus v0.52.1/go.mod h1:3z74cVsmVH0iXOR5QBjB7Pa6A0KJeEAK5A6UsmAFb1g= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector/pdata v1.9.0 h1:qyXe3HEVYYxerIYu0rzgo1Tx2d1Zs6iF+TCckbHLFOw= +go.opentelemetry.io/collector/pdata v1.9.0/go.mod h1:vk7LrfpyVpGZrRWcpjyy0DDZzL3SZiYMQxfap25551w= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 h1:R9DE4kQ4k+YtfLI2ULwX82VtNQ2J8yZmA7ZIF/D+7Mc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0/go.mod h1:OQFyQVrDlbe+R7xrEyDr/2Wr67Ol0hRUgsfA+V5A95s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 h1:QY7/0NeRPKlzusf40ZE4t1VlMKbqSNT7cJRYzWuja0s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0/go.mod h1:HVkSiDhTM9BoUJU8qE6j2eSWLLXvi1USXjyd2BXT8PY= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= +go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= +go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 h1:LoYXNGAShUG3m/ehNk4iFctuhGX/+R1ZpfJ4/ia80JM= +golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= +golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/apimachinery v0.29.3 h1:2tbx+5L7RNvqJjn7RIuIKu9XTsIZ9Z5wX2G22XAa5EU= +k8s.io/apimachinery v0.29.3/go.mod h1:hx/S4V2PNW4OMg3WizRrHutyB5la0iCUbZym+W0EQIU= +k8s.io/client-go v0.29.3 h1:R/zaZbEAxqComZ9FHeQwOh3Y1ZUs7FaHKZdQtIc2WZg= +k8s.io/client-go v0.29.3/go.mod h1:tkDisCvgPfiRpxGnOORfkljmS+UrW+WtXAy2fTvXJB0= +k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= diff --git a/test/oats/http/oats_test.go b/test/oats/http/oats_test.go new file mode 100644 index 000000000..e02ff1cee --- /dev/null +++ b/test/oats/http/oats_test.go @@ -0,0 +1,44 @@ +package oats + +import ( + "fmt" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/grafana/oats/yaml" +) + +func TestYaml(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Yaml Suite") +} + +var _ = Describe("test case", Label("docker", "integration", "slow"), func() { + fmt.Println("First test") + cases, base := yaml.ReadTestCases() + if base != "" { + It("should have at least one test case", func() { + Expect(cases).ToNot(BeEmpty(), "expected at least one test case in %s", base) + }) + } + + configuration, _ := GinkgoConfiguration() + if configuration.ParallelTotal > 1 { + ports := yaml.NewPortAllocator(len(cases)) + for _, c := range cases { + // Ports have to be allocated before we start executing in parallel to avoid taking the same port. + // Even though it sounds unlikely, it happens quite often. + c.PortConfig = ports.AllocatePorts() + } + } + + yaml.VerboseLogging = true + + for _, c := range cases { + Describe(c.Name, Ordered, func() { + yaml.RunTestCase(c) + }) + } +}) diff --git a/test/oats/http/yaml/oats_python_grpc.yaml b/test/oats/http/yaml/oats_python_grpc.yaml new file mode 100644 index 000000000..4e277d1a5 --- /dev/null +++ b/test/oats/http/yaml/oats_python_grpc.yaml @@ -0,0 +1,12 @@ +docker-compose: + generator: generic + files: + - ../docker-compose-beyla-python-grpc.yml +input: + - path: '/query' + +interval: 500ms +expected: + metrics: + - promql: 'rpc_server_duration_count{rpc_method="/routeguide.RouteGuide/GetFeature"}' + value: "> 5" \ No newline at end of file