自動インストゥルメンテーションの構成例
このページでは、一般的な自動インストゥルメンテーション構成シナリオの例について説明します。
- Example 1:
ecom名前空間内のすべての展開をインストゥルメント化します。各ポッドで実行されている Java エージェントは、Ecommerceアプリケーションでコントローラに登録され、階層名はデフォルトで Kubernetes の展開名になります。 - Example 2:すべての名前空間の、名前が
Paymentで始まり、ラベルmodule=paymentを持つ展開のみをインストゥルメント化します。 - Example 3:名前空間
ecomおよびbooksのすべての展開をインストゥルメント化します。books名前空間内のアプリケーションの場合は、コントローラでBookStoreというアプリケーション名を使用し、Java エージェントの特定のバージョンを使用します。 - Example 4:
groceries名前空間が、異なるコントローラのアプリケーション名を使用するように例 3 の構成を上書きし、-javaagentJava 引数を挿入するようにJAVA_OPTS環境変数を上書きします。 - Example 5:名前空間
booksの Node.js アプリケーションと、名前空間groceriesの .NET Core Linux アプリケーションをインストゥルメント化します。また、Node.js アプリケーションで、分析エージェントにトランザクションデータを送信する必要があります。 - Example 6:Java アプリケーションの
strで始まる名前のコンテナを、名前空間ecomでインストゥルメント化します。また、controllerConfConfigMap にあるcontroller-info.xmlおよびapp-agent-config.xml構成ファイルとlogConfConfigMap にあるエージェントのロギング設定用のlog4j2.xmlファイルのカスタムエージェント設定を使用します。これらのConfigMapsは、クラスターエージェントの名前空間にあります。 - Example 7:
groceries名前空間のすべての展開をインストゥルメント化し、booksおよびecom名前空間のPaymentで始まる名前が付いた展開のみをインストゥルメント化します。 - Example 8:名前空間
booksのすべての展開をインストゥルメント化します。books名前空間内のアプリケーションの場合は、コントローラでアプリケーション名BookStoreと階層名tierを使用し、特定のバージョンの Java エージェントを使用します。
- 例1
-
All Deployments within a Namespace
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2 # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: ecom defaultAppName: Ecommerce instrumentationRules: - language: java imageInfo: image: docker.io/appdynamics/java-agent:latest agentMountPath: /opt/appdynamics imagePullPolicy: Always - 例2
-
Specify Names and Labels in a Deployment
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2 # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: .* defaultAppName: Ecommerce instrumentationRules: - matchString: ^Payment labelMatch: - module: payment - 例 3
-
Instrument Deployments in Namespaces and Specify Agent Versions
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2: - "default" # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: ecom|books defaultAppName: Ecommerce instrumentationRules: - namespaceRegex: books appName: BookStore imageInfo: image: "docker.io/appdynamics/java-agent:21.7.0" agentMountPath: /opt/appdynamics imagePullPolicy: Always - namespaceRegex: ecom - 例 4
-
Override Configuration Using Environment Variables
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2 - "default" # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: ecom|books|groceries defaultAppName: Ecommerce imageInfo: java: image: "docker.io/appdynamics/java-agent:latest" agentMountPath: /opt/appdynamics imagePullPolicy: Always instrumentationRules: - namespaceRegex: books appName: BookStore imageInfo: image: "docker.io/appdynamics/java-agent:21.7.0" agentMountPath: /opt/appdynamics imagePullPolicy: Always - namespaceRegex: groceries appName: Groceries env: JAVA_OPTS - namespaceRegex: ecom #no appName and matchstring for this rule so it will take default appName and default matchstring which is .* - 例 5
-
Instrument a Node.js Application with Analytics Agent
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2 # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: ecom|books|groceries defaultAppName: Ecommerce appNameStrategy: namespace imageInfo: java: image: "docker.io/appdynamics/java-agent:latest" agentMountPath: /opt/appdynamics imagePullPolicy: Always instrumentationRules: - namespaceRegex: groceries language: dotnetcore imageInfo: image: "docker.io/appdynamics/dotnet-core-agent:latest" agentMountPath: /opt/appdynamics imagePullPolicy: Always - namespaceRegex: books matchString: openmct language: nodejs imageInfo: image: "docker.io/appdynamics/nodejs-agent:20.5.0-alpinev10" agentMountPath: /opt/appdynamics imagePullPolicy: Always analyticsHost: <hostname of the Analytics Agent> analyticsPort: 443 analyticsSslEnabled: true - 例 6
-
Instrument Containers with Custom Agent Configuration
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2 # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: ecom defaultAppName: Ecommerce instrumentationRules: - namespaceRegex: ecom matchString: ^Payment appName: <application-name> language: <language> customAgentConfigSource: - configMapName: controllerConf subDir: /ver20.8.0.3686/conf/ - configMapName: logConf subDir: /ver20.8.0.3686/conf/logging instrumentContainer: select containerMatchString: ^str imageInfo: image: <image-repo> imagePullPolicy: IfNotPresent - 例 7
-
Instrument Namespaces and Specify Unique Names
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2 # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: ecom|books|groceries defaultAppName: Ecommerce appNameStrategy: namespace defaultMatchString: ^payment imageInfo: java: image: "docker.io/appdynamics/java-agent:latest" agentMountPath: /opt/appdynamics imagePullPolicy: Always instrumentationRules: - namespaceRegex: groceries matchString: .* - namespaceRegex: ecom|books #no matchstring so it will take default matchstring which is ^payment - 例 8
-
apiVersion: cluster.appdynamics.com/v1alpha1 kind: Clusteragent metadata: name: k8s-cluster-agent namespace: appdynamics spec: appName: "<app-name>" controllerUrl: "<protocol>://<appdynamics-controller-host>:8080" account: "<account-name>" # docker image info image: "<your-docker-registry>/appdynamics/cluster-agent:tag" serviceAccountName: appdynamics-cluster-agent nsToMonitorRegex: namespace1|namespace2 # auto-instrumentation config instrumentationMethod: Env nsToInstrumentRegex: books defaultAppName: Ecommerce tierNameStrategy: label instrumentationRules: - namespaceRegex: books appName: BookStore tierNameLabel: tier imageInfo: image: "docker.io/appdynamics/java-agent:21.7.0" agentMountPath: /opt/appdynamics imagePullPolicy: Always