Skip to content

Commit 1b6c3fa

Browse files
committed
otelglobal: Collect user provided tracer version
1 parent 9afc553 commit 1b6c3fa

File tree

23 files changed

+519
-132
lines changed

23 files changed

+519
-132
lines changed

examples/kafka-go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.22.0
55
require (
66
github.com/segmentio/kafka-go v0.4.47
77
go.opentelemetry.io/otel v1.27.0
8+
go.opentelemetry.io/otel/trace v1.27.0
89
)
910

1011
require (
@@ -13,5 +14,4 @@ require (
1314
github.com/klauspost/compress v1.15.9 // indirect
1415
github.com/pierrec/lz4/v4 v4.1.15 // indirect
1516
go.opentelemetry.io/otel/metric v1.27.0 // indirect
16-
go.opentelemetry.io/otel/trace v1.27.0 // indirect
1717
)

examples/kafka-go/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import (
2525
kafka "github.com/segmentio/kafka-go"
2626
"go.opentelemetry.io/otel"
2727
"go.opentelemetry.io/otel/attribute"
28+
"go.opentelemetry.io/otel/trace"
2829
)
2930

30-
var tracer = otel.Tracer("trace-example")
31+
var tracer = otel.Tracer("trace-example-kafka-go", trace.WithInstrumentationVersion("v1.0.0-test"))
3132

3233
type server struct {
3334
kafkaWriter *kafka.Writer

internal/include/go_types.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,36 @@
2323
Keep a power of 2 to help with masks */
2424
#define MAX_SLICE_ARRAY_SIZE 1024
2525

26-
struct go_string
26+
typedef struct go_string
2727
{
2828
char *str;
2929
s64 len;
30-
};
30+
} go_string_t;
3131

32-
struct go_slice
32+
typedef struct go_slice
3333
{
3434
void *array;
3535
s64 len;
3636
s64 cap;
37-
};
37+
} go_slice_t;
3838

39-
struct go_iface
39+
typedef struct go_iface
4040
{
4141
void *tab;
4242
void *data;
43-
};
44-
45-
struct map_bucket {
46-
char tophash[8];
47-
struct go_string keys[8];
48-
struct go_slice values[8];
49-
void *overflow;
43+
} go_iface_t;
44+
45+
// a map bucket type with the given key and value types
46+
#define MAP_BUCKET_TYPE(key_type, value_type) struct map_bucket_##key_type##_##value_type##_t
47+
// a map bucket struct definition with the given key and value types
48+
// for more details about the structure of a map bucket see:
49+
// https://github.com/golang/go/blob/639cc0dcc0948dd02c9d5fc12fbed730a21ebebc/src/runtime/map.go#L143
50+
#define MAP_BUCKET_DEFINITION(key_type, value_type) \
51+
MAP_BUCKET_TYPE(key_type, value_type) { \
52+
char tophash[8]; \
53+
key_type keys[8]; \
54+
value_type values[8]; \
55+
void *overflow; \
5056
};
5157

5258
struct slice_array_buff

internal/pkg/inject/offset_results.json

Lines changed: 193 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,199 @@
10281028
"1.23.1",
10291029
"1.24.0",
10301030
"1.25.0",
1031-
"1.26.0"
1031+
"1.26.0",
1032+
"1.27.0"
1033+
]
1034+
}
1035+
]
1036+
},
1037+
{
1038+
"field": "provider",
1039+
"offsets": [
1040+
{
1041+
"offset": null,
1042+
"versions": [
1043+
"0.1.0",
1044+
"0.1.1",
1045+
"0.1.2",
1046+
"0.2.0",
1047+
"0.2.1",
1048+
"0.2.2",
1049+
"0.2.3",
1050+
"0.3.0",
1051+
"0.4.0",
1052+
"0.4.1",
1053+
"0.4.2",
1054+
"0.4.3",
1055+
"0.5.0",
1056+
"0.6.0",
1057+
"0.7.0",
1058+
"0.8.0",
1059+
"0.9.0",
1060+
"0.10.0",
1061+
"0.11.0",
1062+
"0.12.0",
1063+
"0.13.0",
1064+
"0.14.0",
1065+
"0.15.0",
1066+
"0.16.0",
1067+
"0.17.0",
1068+
"0.18.0",
1069+
"0.19.0",
1070+
"0.20.0"
1071+
]
1072+
},
1073+
{
1074+
"offset": 40,
1075+
"versions": [
1076+
"1.0.0-RC1",
1077+
"1.0.0-RC2",
1078+
"1.0.0-RC3",
1079+
"1.0.0",
1080+
"1.0.1",
1081+
"1.1.0",
1082+
"1.2.0",
1083+
"1.3.0",
1084+
"1.4.0",
1085+
"1.4.1",
1086+
"1.5.0",
1087+
"1.6.0",
1088+
"1.6.1",
1089+
"1.6.2",
1090+
"1.6.3",
1091+
"1.7.0",
1092+
"1.8.0",
1093+
"1.9.0",
1094+
"1.10.0",
1095+
"1.11.0",
1096+
"1.11.1",
1097+
"1.11.2",
1098+
"1.12.0",
1099+
"1.13.0",
1100+
"1.14.0",
1101+
"1.15.0-rc.1",
1102+
"1.15.0-rc.2",
1103+
"1.15.0",
1104+
"1.15.1",
1105+
"1.16.0-rc.1",
1106+
"1.16.0",
1107+
"1.17.0",
1108+
"1.18.0",
1109+
"1.19.0-rc.1",
1110+
"1.19.0"
1111+
]
1112+
},
1113+
{
1114+
"offset": 56,
1115+
"versions": [
1116+
"1.20.0",
1117+
"1.21.0",
1118+
"1.22.0",
1119+
"1.23.0-rc.1",
1120+
"1.23.0",
1121+
"1.23.1",
1122+
"1.24.0",
1123+
"1.25.0",
1124+
"1.26.0",
1125+
"1.27.0"
1126+
]
1127+
}
1128+
]
1129+
}
1130+
]
1131+
},
1132+
{
1133+
"struct": "tracerProvider",
1134+
"fields": [
1135+
{
1136+
"field": "tracers",
1137+
"offsets": [
1138+
{
1139+
"offset": null,
1140+
"versions": [
1141+
"0.1.0",
1142+
"0.1.1",
1143+
"0.1.2",
1144+
"0.2.0",
1145+
"0.2.1",
1146+
"0.2.2",
1147+
"0.2.3",
1148+
"0.3.0",
1149+
"0.4.0",
1150+
"0.4.1",
1151+
"0.4.2",
1152+
"0.4.3",
1153+
"0.5.0",
1154+
"0.6.0",
1155+
"0.7.0",
1156+
"0.8.0",
1157+
"0.9.0",
1158+
"0.10.0",
1159+
"0.11.0",
1160+
"0.12.0",
1161+
"0.13.0"
1162+
]
1163+
},
1164+
{
1165+
"offset": 8,
1166+
"versions": [
1167+
"0.14.0",
1168+
"0.15.0",
1169+
"0.16.0",
1170+
"0.17.0",
1171+
"0.18.0",
1172+
"0.19.0",
1173+
"0.20.0",
1174+
"1.0.0-RC1",
1175+
"1.0.0-RC2",
1176+
"1.0.0-RC3",
1177+
"1.0.0",
1178+
"1.0.1",
1179+
"1.1.0",
1180+
"1.2.0",
1181+
"1.3.0",
1182+
"1.4.0",
1183+
"1.4.1",
1184+
"1.5.0",
1185+
"1.6.0",
1186+
"1.6.1",
1187+
"1.6.2",
1188+
"1.6.3",
1189+
"1.7.0",
1190+
"1.8.0",
1191+
"1.9.0",
1192+
"1.10.0",
1193+
"1.11.0",
1194+
"1.11.1",
1195+
"1.11.2",
1196+
"1.12.0",
1197+
"1.13.0",
1198+
"1.14.0",
1199+
"1.15.0-rc.1",
1200+
"1.15.0-rc.2",
1201+
"1.15.0",
1202+
"1.15.1",
1203+
"1.16.0-rc.1",
1204+
"1.16.0",
1205+
"1.17.0",
1206+
"1.18.0",
1207+
"1.19.0-rc.1",
1208+
"1.19.0"
1209+
]
1210+
},
1211+
{
1212+
"offset": 24,
1213+
"versions": [
1214+
"1.20.0",
1215+
"1.21.0",
1216+
"1.22.0",
1217+
"1.23.0-rc.1",
1218+
"1.23.0",
1219+
"1.23.1",
1220+
"1.24.0",
1221+
"1.25.0",
1222+
"1.26.0",
1223+
"1.27.0"
10321224
]
10331225
}
10341226
]

0 commit comments

Comments
 (0)