Application Insights 与容器 |
您所在的位置:网站首页 › javabin目录 › Application Insights 与容器 |
你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。 入门(补充) 项目 04/23/2023在以下部分中,你将找到有关如何获取特定技术环境的 Java 自动检测的信息。 Azure 应用服务有关详细信息,请参阅 Azure 应用服务和 Java 的应用程序监视。 Azure Functions有关详细信息,请参阅使用 Azure Monitor Application Insights 监视 Azure Functions。 容器 Docker 入口点如果使用的是 exec 形式,请将参数 -javaagent:"path/to/applicationinsights-agent-3.4.12.jar" 添加到参数列表中 "-jar" 参数之前的某个位置,例如: ENTRYPOINT ["java", "-javaagent:path/to/applicationinsights-agent-3.4.12.jar", "-jar", ""]如果使用的是 shell 形式,请在 -jar 之前的某个位置添加 JVM 参数 -javaagent:"path/to/applicationinsights-agent-3.4.12.jar",例如: ENTRYPOINT java -javaagent:"path/to/applicationinsights-agent-3.4.12.jar" -jar Docker 文件Dockerfile 示例: FROM ... COPY target/*.jar app.jar COPY agent/applicationinsights-agent-3.4.12.jar applicationinsights-agent-3.4.12.jar COPY agent/applicationinsights.json applicationinsights.json ENV APPLICATIONINSIGHTS_CONNECTION_STRING="CONNECTION-STRING" ENTRYPOINT["java", "-javaagent:applicationinsights-agent-3.4.12.jar", "-jar", "app.jar"] 第三方容器映像如果使用无法修改的第三方容器映像,请从外部将 Application Insights Java 代理 jar 装入容器中。 为容器 JAVA_TOOL_OPTIONS=-javaagent:/path/to/applicationinsights-agent.jar 设置环境变量。 Spring Boot有关详细信息,请参阅将 Azure Monitor Application Insights 与 Spring Boot 配合使用。 Java 应用程序服务器 Tomcat 8 (Linux) 通过 apt-get 或 yum 安装 Tomcat如果通过 apt-get 或 yum 安装了 Tomcat,则应有文件 /etc/tomcat8/tomcat8.conf。 将以下行添加到该文件的末尾: JAVA_OPTS="$JAVA_OPTS -javaagent:path/to/applicationinsights-agent-3.4.12.jar" 通过下载并解压缩相关软件安装的 Tomcat如果通过从 https://tomcat.apache.org 下载并解压缩相关软件安装了 Tomcat,则应有文件 /bin/catalina.sh。 在同一目录中创建包含以下内容的名为 /bin/setenv.sh 的新文件: CATALINA_OPTS="$CATALINA_OPTS -javaagent:path/to/applicationinsights-agent-3.4.12.jar"如果文件 /bin/setenv.sh 已存在,请修改该文件,将 -javaagent:path/to/applicationinsights-agent-3.4.12.jar 添加到 CATALINA_OPTS。 Tomcat 8 (Windows) 从命令行运行 Tomcat找到文件 /bin/catalina.bat。 在同一目录中创建包含以下内容的名为 /bin/setenv.bat 的新文件: set CATALINA_OPTS=%CATALINA_OPTS% -javaagent:path/to/applicationinsights-agent-3.4.12.jar引号不是必需的,但如果要包括引号,则正确的位置是: set "CATALINA_OPTS=%CATALINA_OPTS% -javaagent:path/to/applicationinsights-agent-3.4.12.jar"如果文件 /bin/setenv.bat 已存在,请修改该文件,将 -javaagent:path/to/applicationinsights-agent-3.4.12.jar 添加到 CATALINA_OPTS。 将 Tomcat 作为 Windows 服务运行找到文件 /bin/tomcat8w.exe。 运行该可执行文件,并将 -javaagent:path/to/applicationinsights-agent-3.4.12.jar 添加到 Java 选项卡下的 Java Options 中。 JBoss EAP 7 独立服务器将 -javaagent:path/to/applicationinsights-agent-3.4.12.jar 添加到文件 JBOSS_HOME/bin/standalone.conf (Linux) 或 JBOSS_HOME/bin/standalone.conf.bat (Windows) 中的现有 JAVA_OPTS 环境变量: JAVA_OPTS="-javaagent:path/to/applicationinsights-agent-3.4.12.jar -Xms1303m -Xmx1303m ..." ... 域服务器将 -javaagent:path/to/applicationinsights-agent-3.4.12.jar 添加到 JBOSS_HOME/domain/configuration/host.xml 中的现有 jvm-options: ... ...如果在单个主机上运行多个托管服务器,则需要将 applicationinsights.agent.id 添加到每个 server 的 system-properties: ... ...指定的 applicationinsights.agent.id 值必须是独一无二的。 它用于在 Application Insights 目录下创建子目录。 每个 JVM 进程都需要自己的本地 Application Insights 配置和本地 Application Insights 日志文件。 此外,如果向中央收集器报告,则 applicationinsights.properties 文件由多个托管服务器共享,因此需要使用指定的 applicationinsights.agent.id 重写该共享文件中的 agent.id 设置。 如果需要重写每个托管服务器的 agent.rollup.id 设置,则可在服务器的 system-properties 中以类似方式指定 applicationinsights.agent.rollup.id。 Jetty 9将以下行添加到 start.ini: --exec -javaagent:path/to/applicationinsights-agent-3.4.12.jar Payara 5将 -javaagent:path/to/applicationinsights-agent-3.4.12.jar 添加到 glassfish/domains/domain1/config/domain.xml 中的现有 jvm-options: ... -javaagent:path/to/applicationinsights-agent-3.4.12.jar> ... ... WebSphere 8打开管理控制台。 转到“服务器”>“WebSphere 应用程序服务器”>“应用程序服务器”。 选择适当的应用程序服务器并选择以下内容: Java and Process Management > Process definition > Java Virtual Machine在 Generic JVM arguments 中,添加以下 JVM 参数: -javaagent:path/to/applicationinsights-agent-3.4.12.jar保存并重启应用程序服务器。 OpenLiberty 18在服务器目录(例如 /usr/servers/defaultServer)中创建新文件 jvm.options,并添加以下行: -javaagent:path/to/applicationinsights-agent-3.4.12.jar 其他请参阅应用程序服务器文档,了解如何添加 JVM 参数。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |