|
13 | 13 | import com.google.protobuf.Message; |
14 | 14 | import com.google.protobuf.util.JsonFormat; |
15 | 15 | import io.opentelemetry.api.common.Attributes; |
| 16 | +import io.opentelemetry.api.common.Value; |
| 17 | +import io.opentelemetry.api.incubator.common.ExtendedAttributeKey; |
16 | 18 | import io.opentelemetry.api.incubator.common.ExtendedAttributes; |
17 | 19 | import io.opentelemetry.api.internal.OtelEncodingUtils; |
18 | 20 | import io.opentelemetry.api.logs.Severity; |
@@ -91,7 +93,7 @@ void toProtoLogRecord(MarshalerSource marshalerSource) { |
91 | 93 | .setSpanContext( |
92 | 94 | SpanContext.create( |
93 | 95 | TRACE_ID, SPAN_ID, TraceFlags.getDefault(), TraceState.getDefault())) |
94 | | - .setTotalAttributeCount(10) |
| 96 | + .setTotalAttributeCount(11) |
95 | 97 | .setTimestamp(12345, TimeUnit.NANOSECONDS) |
96 | 98 | .setObservedTimestamp(6789, TimeUnit.NANOSECONDS) |
97 | 99 | // Extended fields |
@@ -119,6 +121,21 @@ void toProtoLogRecord(MarshalerSource marshalerSource) { |
119 | 121 | .build()) |
120 | 122 | .put("str_key", "str_value") |
121 | 123 | .build()) |
| 124 | + .put( |
| 125 | + ExtendedAttributeKey.valueKey("value_key"), |
| 126 | + Value.of( |
| 127 | + io.opentelemetry.api.common.KeyValue.of( |
| 128 | + "bool_key", Value.of(true)), |
| 129 | + io.opentelemetry.api.common.KeyValue.of( |
| 130 | + "double_key", Value.of(1.1)), |
| 131 | + io.opentelemetry.api.common.KeyValue.of("int_key", Value.of(1)), |
| 132 | + io.opentelemetry.api.common.KeyValue.of( |
| 133 | + "value_key", |
| 134 | + Value.of( |
| 135 | + io.opentelemetry.api.common.KeyValue.of( |
| 136 | + "str_key", Value.of("str_value")))), |
| 137 | + io.opentelemetry.api.common.KeyValue.of( |
| 138 | + "str_key", Value.of("str_value")))) |
122 | 139 | .build()) |
123 | 140 | .build())); |
124 | 141 |
|
@@ -163,6 +180,27 @@ void toProtoLogRecord(MarshalerSource marshalerSource) { |
163 | 180 | .build())) |
164 | 181 | .addValues(keyValue("str_key", anyValue("str_value"))) |
165 | 182 | .build()) |
| 183 | + .build()), |
| 184 | + keyValue( |
| 185 | + "value_key", |
| 186 | + AnyValue.newBuilder() |
| 187 | + .setKvlistValue( |
| 188 | + KeyValueList.newBuilder() |
| 189 | + .addValues(keyValue("bool_key", anyValue(true))) |
| 190 | + .addValues(keyValue("double_key", anyValue(1.1))) |
| 191 | + .addValues(keyValue("int_key", anyValue(1))) |
| 192 | + .addValues( |
| 193 | + keyValue( |
| 194 | + "value_key", |
| 195 | + AnyValue.newBuilder() |
| 196 | + .setKvlistValue( |
| 197 | + KeyValueList.newBuilder() |
| 198 | + .addValues( |
| 199 | + keyValue("str_key", anyValue("str_value"))) |
| 200 | + .build()) |
| 201 | + .build())) |
| 202 | + .addValues(keyValue("str_key", anyValue("str_value"))) |
| 203 | + .build()) |
166 | 204 | .build())); |
167 | 205 | } |
168 | 206 |
|
|
0 commit comments