tencent cloud

Tencent Cloud Observability Platform

Release Notes and Announcements
Release Notes
Product Introduction
Overview
Strengths
Basic Features
Basic Concepts
Use Cases
Use Limits
Purchase Guide
Tencent Cloud Product Monitoring
Application Performance Management
Mobile App Performance Monitoring
Real User Monitoring
Cloud Automated Testing
Prometheus Monitoring
Grafana
EventBridge
PTS
Quick Start
Monitoring Overview
Instance Group
Tencent Cloud Product Monitoring
Application Performance Management
Real User Monitoring
Cloud Automated Testing
Performance Testing Service
Prometheus Getting Started
Grafana
Dashboard Creation
EventBridge
Alarm Service
Cloud Product Monitoring
Tencent Cloud Service Metrics
Operation Guide
CVM Agents
Cloud Product Monitoring Integration with Grafana
Troubleshooting
Practical Tutorial
Application Performance Management
Product Introduction
Access Guide
Operation Guide
Practical Tutorial
Parameter Information
FAQs
Mobile App Performance Monitoring
Overview
Operation Guide
Access Guide
Practical Tutorial
Tencent Cloud Real User Monitoring
Product Introduction
Operation Guide
Connection Guide
FAQs
Cloud Automated Testing
Product Introduction
Operation Guide
FAQs
Performance Testing Service
Overview
Operation Guide
Practice Tutorial
JavaScript API List
FAQs
Prometheus Monitoring
Product Introduction
Access Guide
Operation Guide
Practical Tutorial
Terraform
FAQs
Grafana
Product Introduction
Operation Guide
Guide on Grafana Common Features
FAQs
Dashboard
Overview
Operation Guide
Alarm Management
Console Operation Guide
Troubleshooting
FAQs
EventBridge
Product Introduction
Operation Guide
Practical Tutorial
FAQs
Report Management
FAQs
General
Alarm Service
Concepts
Monitoring Charts
CVM Agents
Dynamic Alarm Threshold
CM Connection to Grafana
Documentation Guide
Related Agreements
Application Performance Management Service Level Agreement
APM Privacy Policy
APM Data Processing And Security Agreement
RUM Service Level Agreement
Mobile Performance Monitoring Service Level Agreement
Cloud Automated Testing Service Level Agreement
Prometheus Service Level Agreement
TCMG Service Level Agreements
PTS Service Level Agreement
PTS Use Limits
Cloud Monitor Service Level Agreement
API Documentation
History
Introduction
API Category
Making API Requests
Monitoring Data Query APIs
Alarm APIs
Legacy Alert APIs
Notification Template APIs
TMP APIs
Grafana Service APIs
Event Center APIs
TencentCloud Managed Service for Prometheus APIs
Monitoring APIs
Data Types
Error Codes
Glossary

Automatic Connecting Java Application for the K8s Environment (Recommended)

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-29 10:45:57
For Java applications deployed on Kubernetes, APM offers automatic connection schemes that enable agent auto-injection to facilitate quick application integration.
Java applications that are automatically connected in the K8s environment will be automatically injected with the Tencent Cloud OpenTelemetry Java Agent Enhanced Edition (TencentCloud-OTel Java Agent). The Tencent Cloud OpenTelemetry Java Agent Enhanced Edition is based on the secondary development of OpenTelemetry-java-instrumentation from the open-source community, adhering to the Apache License 2.0 protocol. The OpenTelemetry License is cited within the agent package. Building upon the open-source agent, the Tencent Cloud OpenTelemetry Java Agent Enhanced Edition has improved significantly in Event Tracking density, advanced diagnosis, performance protection, and enterprise-level capabilities.

Prerequisites

See Supported Java Versions and Frameworks by the OTel Java Agent Enhanced Edition to ensure that the Java version and application server are within the supported range by the agent. For the dependency libraries and frameworks supported by automatic tracing, data reporting can be completed upon successful connection without modifying the code. In addition, the Tencent Cloud OpenTelemetry Java Agent Enhanced Edition adheres to the OpenTelemetry protocol standard. if automatic Event Tracking does not meet your scenario, or you need to add business layer Event Tracking, use OpenTelemetry API for Custom Metrics Definition.

Step 1: Install Operator.

Install Operator in the K8s cluster, it's recommended to install Operator with one click on the APM console, for details see installing tencent-opentelemetry-operator.

Step 2: Add annotation to workload.

Take Tencent Kubernetes Engine (TKE) as an example. You can add annotation in the workload through the following procedure. For common K8s clusters, use tools such as kubectl to add annotation.
1. Log in to TKE console.
2. Click Cluster to enter the corresponding TKE cluster.
3. In Workload, you can find the application that needs to connect APM, click More, then click Edit YAML.
4. Add the following content in the Pod annotation, then click Complete to finish the connection.
cloud.tencent.com/inject-java: "true"
cloud.tencent.com/otel-service-name: my-app # Application name. Processes of connecting with the same application name are displayed as multiple instances under the same application in APM.
# The application name can be up to 63 characters and can only contain lowercase letters, digits, and the separator (-), and it must start with a lowercase letter and end with a digit or lowercase letter.
Note that this content needs to be added to spec.template.metadata.annotations, affecting the Pod's annotation, not the workload's annotation. You can see the following code snippet:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: my-app
name: my-app
namespace: default
spec:
selector:
matchLabels:
k8s-app: my-app
template:
metadata:
labels:
k8s-app: my-app
annotations:
cloud.tencent.com/inject-java: "true" # Add it here.
cloud.tencent.com/otel-service-name: my-app
spec:
containers:
image: my-app:0.1
name: my-app

Connection Verification

After annotations are added to the workload, based on different publish policies, you can trigger a restart of the application pod. The newly launched pod will automatically inject the agent and connect to the APM server to report monitoring data, with the reported business system being the default business system of the Operator. Under normal traffic conditions, the connected application will be displayed in Application Performance Management > Application list. Click Application name/ID to go to the application details page. Select Instance Analysis to view the connected application instances. Since there is a certain latency in the processing of observable data, if the application or instance does not appear in the console after connecting, wait for about 30 seconds.

Custom Event Tracking

When automatic instrumentation does not meet your scenario, or you need to add business layer instrumentation, see Custom Event Tracking and use the OpenTelemetry API to add custom instrumentation.

More Connection Configuration Items (Optional)

At the Workload level, you can add more annotations to adjust the connect behaviors:
Configuration Item
Description
cloud.tencent.com/apm-token
Specify the Token for the APM business system. If this configuration item is not added, the Operator's configuration is used (corresponding to the Operator's env.APM_TOKEN field).
cloud.tencent.com/java-instr-version
Specify the Java agent version. If this configuration item is not added, the configuration of the Operator is used (corresponding to the Operator's env.JAVA_INSTR_VERSION field). The value can be latest (default) or a specific version number. For a list of specific version numbers, see Agent Version Information. It is not recommended to fill in this field unless necessary.
cloud.tencent.com/container-names
Specify the container for agent injection. This configuration item supports injecting probes into multiple containers. Just fill in the names of multiple containers in the value of this configuration item and separate them with commas. If this configuration item is not added, the probe will be default injected into the first container. This configuration item is supported in Operator 0.88 and above versions.


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백