public class Observation
extends Object
Dataset.observe(String, Column, Column*)
:
// Observe row count (rows) and highest id (maxid) in the Dataset while writing it
val observation = Observation("my metrics")
val observed_ds = ds.observe(observation, count(lit(1)).as("rows"), max($"id").as("maxid"))
observed_ds.write.parquet("ds.parquet")
val metrics = observation.get
This collects the metrics while the first action is executed on the observed dataset. Subsequent
actions do not modify the metrics returned by get
. Retrieval of the metric via get
blocks until the first action has finished and metrics become available.
This class does not support streaming datasets.
param: name name of the metric
Constructor and Description |
---|
Observation()
Create an Observation instance without providing a name.
|
Observation(String name) |
Modifier and Type | Method and Description |
---|---|
static Observation |
apply()
Observation constructor for creating an anonymous observation.
|
static Observation |
apply(String name)
Observation constructor for creating a named observation.
|
scala.collection.immutable.Map<String,?> |
get()
(Scala-specific) Get the observed metrics.
|
java.util.Map<String,Object> |
getAsJava()
(Java-specific) Get the observed metrics.
|
String |
name() |
public Observation(String name)
public Observation()
public static Observation apply()
public static Observation apply(String name)
name
- (undocumented)public String name()
public scala.collection.immutable.Map<String,?> get() throws InterruptedException
Map[String, Any]
InterruptedException
- interrupted while waitingpublic java.util.Map<String,Object> getAsJava() throws InterruptedException
java.util.Map[String, Object]
InterruptedException
- interrupted while waiting