8
8
use Opentelemetry \Proto \Trace \V1 \Span as CollectorSpan ;
9
9
use Opentelemetry \Proto \Trace \V1 \Status \StatusCode ;
10
10
use Opentelemetry \Proto \Trace \V1 \Status ;
11
+ use Opentelemetry \Proto \Common \V1 \InstrumentationLibrary
11
12
12
13
class SpanConverter
13
14
{
@@ -44,7 +45,14 @@ private function sanitiseTagValue($value)
44
45
}
45
46
46
47
public function convert (Span $ span )
47
- {
48
+ {
49
+ $ instrumentation_library_spans =[];
50
+ $ il =new InstrumentationLibrary ();
51
+ $ name =$ il ->getName ();
52
+ $ version =$ il ->getVersion ();
53
+
54
+
55
+
48
56
$ spanParent = $ span ->getParent ();
49
57
$ row = [
50
58
'id ' => $ span ->getContext ()->getSpanId (),
@@ -56,6 +64,7 @@ public function convert(Span $span)
56
64
'name ' => $ span ->getSpanName (),
57
65
'timestamp ' => (int ) ($ span ->getStartEpochTimestamp () / 1e3 ), // RealtimeClock in microseconds
58
66
'duration ' => (int ) (($ span ->getEnd () - $ span ->getStart ()) / 1e3 ), // Diff in microseconds
67
+ 'trace_state ' => $ span ->getContext ();
59
68
60
69
];
61
70
@@ -87,10 +96,6 @@ public function convert(Span $span)
87
96
}
88
97
if (!array_key_exists ('status ' , $ row )) {
89
98
$ proto_status = StatusCode::STATUS_CODE_OK ;
90
- //////
91
- /////HIGHLIGHTED
92
- ////
93
- ///
94
99
if ($ span ->getStatus ()->getCanonicalStatusCode () === "ERROR " ) {
95
100
$ proto_status = StatusCode::STATUS_CODE_ERROR ;
96
101
}
@@ -105,4 +110,4 @@ public function convert(Span $span)
105
110
// $key->setKey("id")
106
111
// $value=new AnyValue();
107
112
// $value->setStringValue($span->getContext()->getSpanId());
108
- // $key->setValue($value);
113
+ // $key->setValue($value);
0 commit comments