This topic describes how to grant Managed Service for OpenTelemetry the permissions to read data from and write data to Log Service and how to report application data to Managed Service for OpenTelemetry. This helps you get started with Managed Service for OpenTelemetry. In the example demonstrated in this topic, a Java application is used.
An Alibaba Cloud account is created.
Managed Service for OpenTelemetry is activated.
Log Service is activated.
Resource Access Management (RAM) is activated.
Grant Tracing Analysis the permissions to read data from and write data to Log Service
- Log on to the Tracing Analysis console.
- On the page that appears, click Authorize to grant Tracing Analysis the permissions to read data from and write data to Log Service.
- In the message that appears, click OK.
Use the OpenTelemetry Java agent to perform automatic instrumentation on an application
In the following example, the OpenTelemetry Java agent is used to report the data of a Java application. The OpenTelemetry Java agent allows you to connect OpenTelemetry to Managed Service for OpenTelemetry in a non-intrusive manner and can be used to automatically upload trace data in hundreds of Java frameworks. For more information about the supported frameworks, see Supported libraries, frameworks, application servers, and JVMs. For more information about how to use OpenTelemetry SDK for Java to manually instrument an application and report data, how to use other clients to report data, and how to report the data of applications that are developed in other languages, see the references at the end of this topic.
Download the OpenTelemetry Java agent demo.
Download the OpenTelemetry Java agent.
In the latest version of Assets, find the opentelemetry-javaagent.jar package and download the package.
Obtain the endpoint of the OpenTelemetry Java agent in the Managed Service for OpenTelemetry console.
Log on to the Managed Service for OpenTelemetry console.
In the left-side navigation pane, click Cluster Configurations. Then, click the Access point information tab.
In the top navigation bar, select a region. In the Cluster Information section, turn on Show Token.
In the Client section, click OpenTelemetry.
Obtain an endpoint of OpenTelemetry in the Related Information column of the table in the lower part.Note
If your application is deployed in an Alibaba Cloud production environment, use a Virtual Private Cloud (VPC) endpoint. Otherwise, use a public endpoint.
Modify the VM parameters in the Java startup configuration to submit trace data.
-javaagent:/path/to/opentelemetry-javaagent.jar // Replace the path with the URL that you use to download the OpenTelemetry Java agent. -Dotel.resource.attributes=service.name=<appName> // Replace <appName> with your application name. -Dotel.exporter.otlp.headers=Authentication=<token> -Dotel.exporter.otlp.endpoint=<endpoint>
-javaagent:/Users/carpela/Downloads/opentelemetry-javaagent.jar -Dotel.resource.attributes=service.name=ot-java-agent-sample -Dotel.exporter.otlp.headers=Authentication=b590xxxxuqs@3a75d95xxxxx9b_b59xxxxguqs@53dxxxx2afe8301 -Dotel.exporter.otlp.endpoint=http://tracing-analysis-dc-bj:8090
View the monitoring data
On the Applications page in the Managed Service for OpenTelemetry console, click the name of the application. On the page that appears, view the trace data.
What to do next
After the application data is reported to the Managed Service for OpenTelemetry console, you can perform the following operations in the Managed Service for OpenTelemetry console:
By programming language
Monitor Python applications
Monitor Node.js applications