Release Notes
{"Response":{"RequestId":"f796c81b-d0c6-4cf7-b0fa-4d9194ecad10","Spans":"Base64EncodedString","TotalCount":11151}}
Spans field contains all the link data. Since the data has been compressed, the result needs to be converted in the following three steps.Spans field using Base64 to obtain the compressed byte array.import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.nio.charset.StandardCharsets;import java.util.Base64;import java.util.zip.GZIPInputStream;public class OtApiDecoder {public static String decodeSpans(String spans) {Base64.Decoder base64Decoder = Base64.getDecoder();byte[] bytes = base64Decoder.decode(spans);try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);GZIPInputStream gis = new GZIPInputStream(bais);ByteArrayOutputStream baos = new ByteArrayOutputStream();) {byte[] buffer = new byte[1024];int bytesRead = 0;while ((bytesRead = gis.read(buffer)) != -1) {baos.write(buffer, 0, bytesRead);}bytes = baos.toByteArray();String result = new String(bytes, StandardCharsets.UTF_8);return result;} catch (IOException e) {e.printStackTrace();}return null;}}
{"resourceSpans":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"java-order-service"}}]},"scopeSpans":[{"scope":{"name":"apm/traces/spans","version":"v1.0"},"spans":[{"traceId":"9bda979bfbf9f27f94232909dc2a0a68","spanId":"e2f379eb4405dcb5","parentSpanId":"","name":"GET /slowSql","kind":2,"startTimeUnixNano":"1741082699964148","endTimeUnixNano":"1741082703966151","attributes":[{"key":"key1","value":{"stringValue":"value1"}},{"key":"key2","value":{"stringValue":"value2"}}],"status":{"code":0}}]}]}]}
spans field. The specific content of each Span follows the OpenTelemetry protocol standard. In the attribute set (reflected by the attributes field), APM has enhanced the following attributes based on the OpenTelemetry protocol standard:Attribute | Description |
service.instance | Represents the application instance that generated the Span, taken from the host.name field in Resource. When using Tencent Cloud enhanced Java probe for integration, or integrating in a TKE environment through tencent-opentelemetry-operator one-click integration, the probe will automatically include this information. For other integration schemes, add host.name to Resource when integrating applications. For details, see Custom Application Instance Attributes. |
peer.service | Represents the peer service of this Span. If the calling role of the current Span is Server, APM will set this field to the application initiating the request; if the calling role of the current Span is Client, APM will set this field to the target application of the request. |
status_code_xx | Represents the status code of this Span. APM integrates status codes of various protocols in this field, expressed in the form of protocol_status code, such as HTTP_404 or gRPC_0. |
origin.operation | Represents the name of this Span. Since APM has the ability to automatically converge API names, the Span name saved in the name field may be modified. APM will save the original Span name in this field. |
db.statement.excess | Represents the SQL statement of this Span, applicable to database request Spans. Since the SQL statement saved in the metric data has a length limit, the SQL statement saved in the db.query.text attribute may be truncated. APM will save the original SQL statement in this field. |
component | Represents the event tracking component of this Span. Tencent Cloud Enhanced Java probes and some open-source OpenTelemetry probes will automatically include this information. |
agent.version | Represents the version of the probe used for application access. The Tencent Cloud Enhanced Java probe will automatically include this information. |
Field Name | Description |
All Spans must be specified, representing the type of Span, which is called the call role in APM. The value can be one of Server, Client, Producer, Consumer, Internal. | |
Represents the status of a Span. The value can be one of Ok, Error, Unset. | |
Represents the error type of a Span. When the status of a Span is Error, it is recommended to specify it. APM will aggregate and count error Spans based on the dimension of error type. | |
Represents the error information of a Span. It is recommended to specify it when the status of a Span is Error. |
Field Name | Description |
Represents the database type. This field must be specified in the attribute set (attributes) when the Span is a database call. | |
Represents the address of the database service. When the Span is a database call, it is recommended to specify this field in the attribute set (attributes). | |
Represents the port of the database service. It is recommended to specify this field in the attribute set (attributes) when the Span is a database call. | |
Represents the database name. When the Span is a database call, it is recommended to specify this field in the attribute set (attributes). | |
Represents the database query statement (SQL). This field must be specified in the attribute set (attributes) when the Span is a database call. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan