-
Notifications
You must be signed in to change notification settings - Fork 751
[GOBBLIN-2220]: Send Metrics When Flow Spec Already Exists For An Adhoc Flow #4136
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
base: master
Are you sure you want to change the base?
Changes from 9 commits
5cdca97
436e081
9940fcd
506a2e0
5a5efdd
b5a946d
3d7c21d
1e8d444
9d1c02e
f5e8dc3
bb0ba83
05af792
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ public class FlowConfigsV2ResourceHandler implements FlowConfigsResourceHandlerI | |
protected FlowCatalog flowCatalog; | ||
protected final ContextAwareMeter createFlow; | ||
protected final ContextAwareMeter deleteFlow; | ||
protected final ContextAwareMeter flowSpecExistsForAdhocFlow; | ||
protected final ContextAwareMeter runImmediatelyFlow; | ||
|
||
@Inject | ||
|
@@ -100,6 +101,8 @@ public FlowConfigsV2ResourceHandler(@Named(InjectionNames.SERVICE_NAME) String s | |
MetricRegistry.name(ServiceMetricNames.GOBBLIN_SERVICE_PREFIX, ServiceMetricNames.DELETE_FLOW_METER)); | ||
this.runImmediatelyFlow = metricContext.contextAwareMeter( | ||
MetricRegistry.name(ServiceMetricNames.GOBBLIN_SERVICE_PREFIX, ServiceMetricNames.RUN_IMMEDIATELY_FLOW_METER)); | ||
this.flowSpecExistsForAdhocFlow = metricContext.contextAwareMeter( | ||
MetricRegistry.name(ServiceMetricNames.GOBBLIN_SERVICE_PREFIX, ServiceMetricNames. RUN_IMMEDIATELY_FLOW_METER)); | ||
aga9900 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
|
||
public FlowConfig getFlowConfig(FlowId flowId) | ||
|
@@ -248,8 +251,22 @@ public CreateKVResponse<ComplexResourceKey<FlowId, FlowStatusId>, FlowConfig> cr | |
// Return conflict and take no action if flowSpec has already been created | ||
if (this.flowCatalog.exists(flowSpec.getUri())) { | ||
log.warn("FlowSpec with URI {} already exists, no action will be taken", flowSpec.getUri()); | ||
return new CreateKVResponse<>(new RestLiServiceException(HttpStatus.S_409_CONFLICT, | ||
"FlowSpec with URI " + flowSpec.getUri() + " already exists, no action will be taken")); | ||
try { | ||
FlowSpec storedFlowSpec = this.flowCatalog.getSpecs(flowSpec.getUri()); | ||
if (!storedFlowSpec.isScheduled()) { | ||
log.error("FlowSpec Already Exists As Adhoc Flow with URI: " + flowSpec.getUri()); | ||
aga9900 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
if (!flowSpec.isScheduled()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it was an adhoc flow( |
||
flowSpecExistsForAdhocFlow.mark(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there’s an expected case where a FlowSpec isn't deleted for an adhoc flow, specifically when a new flow is triggered before the previous one is launched. In that case, we throw a This would mark the metric for both the scenarios and we would have false/non-actionable alerts in such cases |
||
} | ||
} else { | ||
log.error("FlowSpec Already Exists As Scheduled Flow with URI: " + flowSpec.getUri()); | ||
} | ||
} catch (SpecNotFoundException e) { | ||
log.error("Error Retrieving FLow For Existing Flow With URI: " + flowSpec.getUri()); | ||
Comment on lines
+264
to
+265
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not required, since the if block has already checked for existence of flowSpec |
||
} finally { | ||
return new CreateKVResponse<>(new RestLiServiceException(HttpStatus.S_409_CONFLICT, | ||
"FlowSpec with URI " + flowSpec.getUri() + " already exists, no action will be taken")); | ||
} | ||
} | ||
|
||
Map<String, AddSpecResponse> responseMap; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,14 @@ public final boolean conclude() { | |
FlowSpec flowSpec = | ||
this.dagManagementStateStore.getFlowSpec(FlowSpec.Utils.createFlowSpecUri(dagId.getFlowId())); | ||
if (!flowSpec.isScheduled()) { | ||
dagManagementStateStore.removeFlowSpec(flowSpec.getUri(), new Properties(), false); | ||
try { | ||
//This can throw Runtime, IllegalState and IO Exceptions which are not caught here. | ||
dagManagementStateStore.removeFlowSpec(flowSpec.getUri(), new Properties(), false); | ||
} catch (Exception e) { | ||
super.dagProcEngineMetrics.markDagActionsConflowFlowSpecRemoval(this.dagAction.getDagActionType(), false); | ||
log.error("Failed to Remove The FlowSpec For Adhoc Flow with URI: " + flowSpec.getUri()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please log the exception as well using |
||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. earlier the RuntimeException was not caught here, so it was getting caught in DagProcessingEngine which was marking |
||
} | ||
} | ||
return true; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.