Alibaba Cloud Service Mesh (ASM) integrates Alibaba Cloud Tracing Analysis. Tracing Analysis provides a wide range of tools to help developers identify performance bottlenecks of distributed applications. This helps developers improve the efficiency of developing and troubleshooting applications that use a microservices model. The provided tools can be used to map traces, offer trace topologies, analyze application dependencies, and calculate the number of requests. This topic describes how to use Tracing Analysis in ASM.
Prerequisites
- Tracing Analysis is activated.
- An ASM instance is created and Tracing Analysis is enabled for the instance. For more information, see Create an ASM instance.
Background information
x-request-id
x-b3-traceid
x-b3-spanid
x-b3-parentspanid
x-b3-sampled
x-b3-flags
x-ot-span-context
Deployment example
def getForwardHeaders(request):
headers = {}
# x-b3-*** headers can be populated using the opentracing span
span = get_current_span()
carrier = {}
tracer.inject(
span_context=span.context,
format=Format.HTTP_HEADERS,
carrier=carrier)
headers.update(carrier)
# ...
incoming_headers = ['x-request-id']
# ...
for ihdr in incoming_headers:
val = request.headers.get(ihdr)
if val is not None:
headers[ihdr] = val
return headers
@GET
@Path("/reviews/{productId}")
public Response bookReviewsById(@PathParam("productId") int productId,
@HeaderParam("end-user") String user,
@HeaderParam("x-request-id") String xreq,
@HeaderParam("x-b3-traceid") String xtraceid,
@HeaderParam("x-b3-spanid") String xspanid,
@HeaderParam("x-b3-parentspanid") String xparentspanid,
@HeaderParam("x-b3-sampled") String xsampled,
@HeaderParam("x-b3-flags") String xflags,
@HeaderParam("x-ot-span-context") String xotspan) {
if (ratings_enabled) {
JsonObject ratingsResponse = getRatings(Integer.toString(productId), user, xreq, xtraceid, xspanid, xparentspanid, xsampled, xflags, xotspan);
Access example
Enter a URL in the format of http://{IP address of the ingress gateway service}/productpage in the address bar of your browser, and then press the Enter key. You are navigated to the page of the Bookinfo application.
View applications
On the Applications page of the Tracing Analysis console, you can view the key metrics of all monitored applications, including the numbers of requests and errors in the current day and the health status. You can also set tags for applications so that you can filter applications by tag.
- Log on to the Tracing Analysis console.
- In the left-side navigation pane, click Applications. At the top of the Applications page, select a region as needed.
View application details
On the Application Details page of an application in the Tracing Analysis console, you can view the key metrics, call topology, and traces of the application on each server on which it is deployed.
View the waterfall chart of a trace
The waterfall chart of a trace shows the information of the trace, including the log generation time, status, IP address or server name, service name, and timeline.
FAQ
Why is no trace information displayed after I enable Tracing Analysis for my ASM instance and set the Sampling Method parameter to Enable Tracing Analysis?