Skip to content

Commit

Permalink
Merge pull request #621 from data-integrations/revert-614-directive-m…
Browse files Browse the repository at this point in the history
…etrics

Revert "Add metrics for directives"
  • Loading branch information
fernst authored Mar 29, 2023
2 parents 957a171 + c5f9fe3 commit 240bd32
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 291 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
Expand Down
8 changes: 1 addition & 7 deletions wrangler-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<artifactId>wrangler-api</artifactId>
<name>Wrangler API</name>
<description>Wrangler API Library.</description>
<description>Wrangler API Libaray.</description>

<dependencies>
<dependency>
Expand All @@ -39,12 +39,6 @@
<version>${cdap.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.cdap.cdap</groupId>
<artifactId>cdap-watchdog-api</artifactId>
<version>${cdap.version}</version>
<scope>provided</scope>
</dependency>

</dependencies>
</project>

This file was deleted.

31 changes: 0 additions & 31 deletions wrangler-api/src/main/java/io/cdap/wrangler/api/EntityMetrics.java

This file was deleted.

5 changes: 0 additions & 5 deletions wrangler-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@
<artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>io.cdap.cdap</groupId>
<artifactId>cdap-common</artifactId>
<version>${cdap.version}</version>
</dependency>
<dependency>
<groupId>io.cdap.cdap</groupId>
<artifactId>cdap-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package io.cdap.directives.aggregates;

import com.google.common.collect.ImmutableList;
import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.wrangler.api.Arguments;
import io.cdap.wrangler.api.Directive;
import io.cdap.wrangler.api.DirectiveExecutionException;
import io.cdap.wrangler.api.DirectiveParseException;
import io.cdap.wrangler.api.EntityMetricDef;
import io.cdap.wrangler.api.ExecutorContext;
import io.cdap.wrangler.api.Row;
import io.cdap.wrangler.api.TransientVariableScope;
Expand All @@ -38,7 +36,6 @@
import io.cdap.wrangler.expression.ELContext;
import io.cdap.wrangler.expression.ELException;
import io.cdap.wrangler.expression.ELResult;
import io.cdap.wrangler.metrics.DirectiveJEXLCategoryMetric;

import java.util.List;

Expand All @@ -50,7 +47,7 @@
@Name(IncrementTransientVariable.NAME)
@Categories(categories = { "transient"})
@Description("Wrangler - A interactive tool for data cleansing and transformation.")
public class IncrementTransientVariable implements Directive, DirectiveJEXLCategoryMetric {
public class IncrementTransientVariable implements Directive {
public static final String NAME = "increment-variable";
private String variable;
private long incrementBy;
Expand Down Expand Up @@ -111,10 +108,4 @@ public List<Row> execute(List<Row> rows, ExecutorContext context) throws Directi
public void destroy() {
// no-op
}

@Override
public List<EntityMetricDef> getMetrics() {
EntityMetricDef jexlCategoryMetric = getJEXLCategoryMetric(el.getScriptParsedText());
return (jexlCategoryMetric == null) ? ImmutableList.of() : ImmutableList.of(jexlCategoryMetric);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package io.cdap.directives.aggregates;

import com.google.common.collect.ImmutableList;
import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.wrangler.api.Arguments;
import io.cdap.wrangler.api.Directive;
import io.cdap.wrangler.api.DirectiveExecutionException;
import io.cdap.wrangler.api.DirectiveParseException;
import io.cdap.wrangler.api.EntityMetricDef;
import io.cdap.wrangler.api.ExecutorContext;
import io.cdap.wrangler.api.Row;
import io.cdap.wrangler.api.TransientVariableScope;
Expand All @@ -37,7 +35,6 @@
import io.cdap.wrangler.expression.ELContext;
import io.cdap.wrangler.expression.ELException;
import io.cdap.wrangler.expression.ELResult;
import io.cdap.wrangler.metrics.DirectiveJEXLCategoryMetric;

import java.util.List;

Expand All @@ -51,7 +48,7 @@
@Name(SetTransientVariable.NAME)
@Categories(categories = { "transient"})
@Description("Sets the value for a transient variable for the record being processed.")
public class SetTransientVariable implements Directive, DirectiveJEXLCategoryMetric {
public class SetTransientVariable implements Directive {
public static final String NAME = "set-variable";
private EL el;
private String variable;
Expand Down Expand Up @@ -99,10 +96,4 @@ public List<Row> execute(List<Row> rows, ExecutorContext context) throws Directi
}
return rows;
}

@Override
public List<EntityMetricDef> getMetrics() {
EntityMetricDef jexlCategoryMetric = getJEXLCategoryMetric(el.getScriptParsedText());
return (jexlCategoryMetric == null) ? ImmutableList.of() : ImmutableList.of(jexlCategoryMetric);
}
}
11 changes: 1 addition & 10 deletions wrangler-core/src/main/java/io/cdap/directives/row/Fail.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package io.cdap.directives.row;

import com.google.common.collect.ImmutableList;
import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.wrangler.api.Arguments;
import io.cdap.wrangler.api.Directive;
import io.cdap.wrangler.api.DirectiveExecutionException;
import io.cdap.wrangler.api.DirectiveParseException;
import io.cdap.wrangler.api.EntityMetricDef;
import io.cdap.wrangler.api.ExecutorContext;
import io.cdap.wrangler.api.Row;
import io.cdap.wrangler.api.annotations.Categories;
Expand All @@ -37,7 +35,6 @@
import io.cdap.wrangler.expression.ELContext;
import io.cdap.wrangler.expression.ELException;
import io.cdap.wrangler.expression.ELResult;
import io.cdap.wrangler.metrics.DirectiveJEXLCategoryMetric;

import java.util.List;

Expand All @@ -48,7 +45,7 @@
@Name(Fail.NAME)
@Categories(categories = { "row", "data-quality"})
@Description("Fails when the condition is evaluated to true.")
public class Fail implements Directive, Lineage, DirectiveJEXLCategoryMetric {
public class Fail implements Directive, Lineage {
public static final String NAME = "fail";
private String condition;
private EL el;
Expand Down Expand Up @@ -109,10 +106,4 @@ public Mutation lineage() {
el.variables().forEach(col -> builder.relation(col, col));
return builder.build();
}

@Override
public List<EntityMetricDef> getMetrics() {
EntityMetricDef jexlCategoryMetric = getJEXLCategoryMetric(el.getScriptParsedText());
return (jexlCategoryMetric == null) ? ImmutableList.of() : ImmutableList.of(jexlCategoryMetric);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package io.cdap.directives.row;

import com.google.common.collect.ImmutableList;
import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.wrangler.api.Arguments;
import io.cdap.wrangler.api.Directive;
import io.cdap.wrangler.api.DirectiveExecutionException;
import io.cdap.wrangler.api.DirectiveParseException;
import io.cdap.wrangler.api.EntityMetricDef;
import io.cdap.wrangler.api.ExecutorContext;
import io.cdap.wrangler.api.Optional;
import io.cdap.wrangler.api.Row;
Expand All @@ -38,7 +36,6 @@
import io.cdap.wrangler.expression.EL;
import io.cdap.wrangler.expression.ELContext;
import io.cdap.wrangler.expression.ELException;
import io.cdap.wrangler.metrics.DirectiveJEXLCategoryMetric;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -56,7 +53,7 @@
@Name(RecordConditionFilter.NAME)
@Categories(categories = { "row", "data-quality"})
@Description("Filters rows based on condition type specified.")
public class RecordConditionFilter implements Directive, Lineage, DirectiveJEXLCategoryMetric {
public class RecordConditionFilter implements Directive, Lineage {
public static final String NAME = "filter-row";
private EL el;
private boolean isTrue;
Expand Down Expand Up @@ -122,10 +119,4 @@ public Mutation lineage() {
el.variables().forEach(column -> builder.relation(column, column));
return builder.build();
}

@Override
public List<EntityMetricDef> getMetrics() {
EntityMetricDef jexlCategoryMetric = getJEXLCategoryMetric(el.getScriptParsedText());
return (jexlCategoryMetric == null) ? ImmutableList.of() : ImmutableList.of(jexlCategoryMetric);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package io.cdap.directives.row;

import com.google.common.collect.ImmutableList;
import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.wrangler.api.Arguments;
import io.cdap.wrangler.api.Directive;
import io.cdap.wrangler.api.DirectiveExecutionException;
import io.cdap.wrangler.api.DirectiveParseException;
import io.cdap.wrangler.api.EntityMetricDef;
import io.cdap.wrangler.api.ErrorRowException;
import io.cdap.wrangler.api.ExecutorContext;
import io.cdap.wrangler.api.Optional;
Expand All @@ -41,7 +39,6 @@
import io.cdap.wrangler.expression.ELContext;
import io.cdap.wrangler.expression.ELException;
import io.cdap.wrangler.expression.ELResult;
import io.cdap.wrangler.metrics.DirectiveJEXLCategoryMetric;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -59,7 +56,7 @@
@Name(SendToError.NAME)
@Categories(categories = { "row", "data-quality"})
@Description("Send records that match condition to the error collector.")
public class SendToError implements Directive, Lineage, DirectiveJEXLCategoryMetric {
public class SendToError implements Directive, Lineage {
public static final String NAME = "send-to-error";
private EL el;
private String condition;
Expand Down Expand Up @@ -141,10 +138,4 @@ public Mutation lineage() {
el.variables().forEach(column -> builder.relation(column, column));
return builder.build();
}

@Override
public List<EntityMetricDef> getMetrics() {
EntityMetricDef jexlCategoryMetric = getJEXLCategoryMetric(el.getScriptParsedText());
return (jexlCategoryMetric == null) ? ImmutableList.of() : ImmutableList.of(jexlCategoryMetric);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package io.cdap.directives.row;

import com.google.common.collect.ImmutableList;
import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.wrangler.api.Arguments;
import io.cdap.wrangler.api.Directive;
import io.cdap.wrangler.api.DirectiveExecutionException;
import io.cdap.wrangler.api.DirectiveParseException;
import io.cdap.wrangler.api.EntityMetricDef;
import io.cdap.wrangler.api.ExecutorContext;
import io.cdap.wrangler.api.Optional;
import io.cdap.wrangler.api.ReportErrorAndProceed;
Expand All @@ -42,7 +40,6 @@
import io.cdap.wrangler.expression.ELContext;
import io.cdap.wrangler.expression.ELException;
import io.cdap.wrangler.expression.ELResult;
import io.cdap.wrangler.metrics.DirectiveJEXLCategoryMetric;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -60,7 +57,7 @@
@Name(SendToErrorAndContinue.NAME)
@Categories(categories = { "row", "data-quality"})
@Description("Send records that match condition to the error collector and continues processing.")
public class SendToErrorAndContinue implements Directive, Lineage, DirectiveJEXLCategoryMetric {
public class SendToErrorAndContinue implements Directive, Lineage {
public static final String NAME = "send-to-error-and-continue";
private EL el;
private String condition;
Expand Down Expand Up @@ -140,10 +137,4 @@ public Mutation lineage() {
el.variables().forEach(column -> builder.relation(column, column));
return builder.build();
}

@Override
public List<EntityMetricDef> getMetrics() {
EntityMetricDef jexlCategoryMetric = getJEXLCategoryMetric(el.getScriptParsedText());
return (jexlCategoryMetric == null) ? ImmutableList.of() : ImmutableList.of(jexlCategoryMetric);
}
}
Loading

0 comments on commit 240bd32

Please sign in to comment.