设置 Java 和 Scala 环境以使用遥测类¶
You can build and package handler code that uses the com.snowflake.telemetry.Telemetry class, then reference the handler on a stage.
The Telemetry library is available through Maven and through an archive file that you can download from the
Drivers and Libraries page (https://developers.snowflake.com/drivers-and-libraries/) in the Snowflake Developer site.
如果您使用 Maven 开发 Java 或 Scala 中的函数或过程处理程序,则可以构建包含代码的 JAR 文件:
-
In the pom.xml file for your project, add a dependency on the
com.snowflake:telemetrypackage: -
Exclude the
telemetrypackage from the JAR file that you build because it is already included in Snowflake.-
In the directory for your project, create a subdirectory named
assembly/. -
在该目录中,创建一个程序集描述符文件,该文件指定要在 JAR 文件中包含依赖关系。
For an example, see jar-with-dependencies (https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies).
-
In the assembly descriptor, add a
<dependencySet>element that excludes the Snowpark library from your JAR file. For example:For information about the elements in an assembly descriptor, see Assembly Descriptor Format (https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html).
-
-
In your pom.xml file, under the
<project>»<build>»<plugins>, add a<plugin>element for the Maven Assembly Plugin.In addition, under
<configuration>»<descriptors>, add a<descriptor>that points to the assembly descriptor file that you created in the previous steps.
例如: