Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide stable jobName in RowMetrics labels #1028

Merged
merged 3 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
import feast.proto.types.FeatureRowProto.FeatureRow;
import feast.proto.types.FieldProto.Field;
import feast.proto.types.ValueProto.Value;
import java.util.ArrayList;
import java.util.DoubleSummaryStatistics;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.values.KV;
import org.apache.commons.math3.stat.descriptive.rank.Percentile;
Expand Down Expand Up @@ -149,6 +146,10 @@ public void processElement(
}
}

String[] split = context.getPipelineOptions().getJobName().split("-");
String jobNameWithoutTimestamp =
Arrays.stream(split).limit(split.length - 1).collect(Collectors.joining("-"));

for (Entry<String, DoubleSummaryStatistics> entry : featureNameToStats.entrySet()) {
String featureName = entry.getKey();
DoubleSummaryStatistics stats = entry.getValue();
Expand All @@ -157,7 +158,7 @@ public void processElement(
FEATURE_SET_PROJECT_TAG_KEY + ":" + projectName,
FEATURE_SET_NAME_TAG_KEY + ":" + featureSetName,
FEATURE_TAG_KEY + ":" + featureName,
INGESTION_JOB_NAME_KEY + ":" + context.getPipelineOptions().getJobName(),
INGESTION_JOB_NAME_KEY + ":" + jobNameWithoutTimestamp,
METRICS_NAMESPACE_KEY + ":" + getMetricsNamespace(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import feast.proto.types.ValueProto.Value;
import feast.proto.types.ValueProto.Value.ValCase;
import java.time.Clock;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.values.KV;
Expand Down Expand Up @@ -192,11 +194,15 @@ public void processElement(
}
}

String[] split = c.getPipelineOptions().getJobName().split("-");
String jobNameWithoutTimestamp =
Arrays.stream(split).limit(split.length - 1).collect(Collectors.joining("-"));

String[] tags = {
STORE_TAG_KEY + ":" + getStoreName(),
FEATURE_SET_PROJECT_TAG_KEY + ":" + featureSetProject,
FEATURE_SET_NAME_TAG_KEY + ":" + featureSetName,
INGESTION_JOB_NAME_KEY + ":" + c.getPipelineOptions().getJobName(),
INGESTION_JOB_NAME_KEY + ":" + jobNameWithoutTimestamp,
METRICS_NAMESPACE_KEY + ":" + getMetricsNamespace(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class WriteFeatureValueMetricsDoFnTest {
@Test
public void shouldSendCorrectStatsDMetrics() throws IOException, InterruptedException {
PipelineOptions pipelineOptions = PipelineOptionsFactory.create();
pipelineOptions.setJobName("job");
pipelineOptions.setJobName("job-12345678");

Map<String, Iterable<FeatureRow>> input =
readTestInput("feast/ingestion/transform/WriteFeatureValueMetricsDoFnTest.input");
Expand Down