自動インストゥルメンテーションの構成例

このページでは、一般的な自動インストゥルメンテーション構成シナリオの例について説明します。

  • Example 1ecom 名前空間内のすべての展開をインストゥルメント化します。各ポッドで実行されている Java エージェントは、Ecommerce アプリケーションでコントローラに登録され、階層名はデフォルトで Kubernetes の展開名になります。
  • Example 2:すべての名前空間の、名前が Payment で始まり、ラベル module=payment を持つ展開のみをインストゥルメント化します。
  • Example 3:名前空間 ecom および books のすべての展開をインストゥルメント化します。books 名前空間内のアプリケーションの場合は、コントローラで BookStore というアプリケーション名を使用し、Java エージェントの特定のバージョンを使用します。
  • Example 4groceries 名前空間が、異なるコントローラのアプリケーション名を使用するように例 3 の構成を上書きし、-javaagent Java 引数を挿入するように JAVA_OPTS 環境変数を上書きします。
  • Example 5:名前空間 books の Node.js アプリケーションと、名前空間 groceries の .NET Core Linux アプリケーションをインストゥルメント化します。また、Node.js アプリケーションで、分析エージェントにトランザクションデータを送信する必要があります。
  • Example 6:Java アプリケーションの str で始まる名前のコンテナを、名前空間 ecom でインストゥルメント化します。また、controllerConf ConfigMap にある controller-info.xml および app-agent-config.xml 構成ファイルと logConf ConfigMap にあるエージェントのロギング設定用の log4j2.xml ファイルのカスタムエージェント設定を使用します。これらの ConfigMaps は、クラスターエージェントの名前空間にあります。
  • Example 7groceries 名前空間のすべての展開をインストゥルメント化し、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