Skip to content

Commit

Permalink
SNOW-1480779 Support Method Chain in the Telemetry (#121)
Browse files Browse the repository at this point in the history
* create methodChain

* alias

* rollup

* groupByGroupingSets

* limit

* na

* chain

* add method chain

* update

* update test

* fix test

* fix test

* fix test

* fix test

* fix test

* reformat

* fix test

* rename
  • Loading branch information
sfc-gh-bli authored Jul 22, 2024
1 parent a86197d commit 3c03b99
Show file tree
Hide file tree
Showing 18 changed files with 821 additions and 354 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.snowflake.snowpark_java.types;

/** The Snowflake class provides access to the CloudProviderToken secret object with the following properties: accessKeyId,
* secretAccessKey, and token.*/

/**
* The Snowflake class provides access to the CloudProviderToken secret object with the following
* properties: accessKeyId, secretAccessKey, and token.
*/
public class CloudProviderToken {
private final String accessKeyId;
private final String secretAccessKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public UsernamePassword getUsernamePassword(String secretName) {
}

/**
* Get the Cloud provider token from the secret. On success, it returns a valid object with access key id,
* secret access key and token.
* Get the Cloud provider token from the secret. On success, it returns a valid object with access
* key id, secret access key and token.
*
* @param secretName name of the secret object.
*/
Expand Down
16 changes: 11 additions & 5 deletions src/main/scala/com/snowflake/snowpark/CopyableDataFrame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import com.snowflake.snowpark.internal.analyzer._
class CopyableDataFrame private[snowpark] (
override private[snowpark] val session: Session,
override private[snowpark] val plan: SnowflakePlan,
override private[snowpark] val methodChain: Seq[String],
private val stagedFileReader: StagedFileReader)
extends DataFrame(session, plan) {
extends DataFrame(session, plan, methodChain) {

/**
* Executes a `COPY INTO <table_name>` command to
Expand Down Expand Up @@ -238,7 +239,7 @@ class CopyableDataFrame private[snowpark] (
* @group basic
*/
override def clone: CopyableDataFrame = action("clone", 2) {
new CopyableDataFrame(session, plan, stagedFileReader)
new CopyableDataFrame(session, plan, Seq(), stagedFileReader)
}

/**
Expand All @@ -261,11 +262,12 @@ class CopyableDataFrame private[snowpark] (

@inline override protected def action[T](funcName: String)(func: => T): T = {
val isScala: Boolean = this.session.conn.isScalaAPI
OpenTelemetry.action("CopyableDataFrame", funcName, isScala)(func)
OpenTelemetry.action("CopyableDataFrame", funcName, methodChainString, isScala)(func)
}
@inline protected def action[T](funcName: String, javaOffset: Int)(func: => T): T = {
val isScala: Boolean = this.session.conn.isScalaAPI
OpenTelemetry.action("CopyableDataFrame", funcName, isScala, javaOffset)(func)
OpenTelemetry.action("CopyableDataFrame", funcName, methodChainString, isScala, javaOffset)(
func)
}
}

Expand Down Expand Up @@ -360,6 +362,10 @@ class CopyableDataFrameAsyncActor private[snowpark] (cdf: CopyableDataFrame)

@inline override protected def action[T](funcName: String)(func: => T): T = {
val isScala: Boolean = cdf.session.conn.isScalaAPI
OpenTelemetry.action("CopyableDataFrameAsyncActor", funcName, isScala)(func)
OpenTelemetry.action(
"CopyableDataFrameAsyncActor",
funcName,
cdf.methodChainString + ".async",
isScala)(func)
}
}
Loading

0 comments on commit 3c03b99

Please sign in to comment.