Service Integration with Sentinel Monitoring¶
This document describes how to integrate traditional microservices with the Sentinel monitoring feature.
-
Add Dependencies
The version of the
sentinel metric exporter
SDK needs to be >= v2.0.0-alpha.<dependency> <groupId>com.alibaba.csp</groupId> <artifactId>sentinel-metric-exporter</artifactId> <version>v2.0.0-alpha</version> </dependency>
If you want to understand the reasons behind it, you can refer to: https://github.com/alibaba/Sentinel/pull/2976
-
When starting the service, add the
For detailed information about JMX, you can refer to Exposing JVM Monitoring Metrics using JMX Exporter.javaagent
parameter and set the JMX port to12345
. -
Create a Kubernetes Service for your service. Pay attention to the following parameters:
-
labels
field: Set it toskoala.io/type: sentinel
. -
ports
field: Set it toname: jmx-metrics
,port: 12345
,targetPort: 12345
.
-
Note
If you want to understand the reasons behind it, you can refer to the definition of the ServiceMonitor CR.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
release: insight-agent
operator.insight.io/managed-by: insight
name: sentinel-service-monitor
spec:
endpoints:
- port: jmx-metrics
scheme: http
jobLabel: jobLabel
namespaceSelector:
any: true
selector:
matchLabels:
skoala.io/type: sentinel