-
Notifications
You must be signed in to change notification settings - Fork 749
[GOBBLIN- 1856] Add flow trigger handler leasing metrics #3717
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
Changes from 2 commits
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 |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |
| import org.apache.gobblin.instrumented.Instrumented; | ||
| import org.apache.gobblin.metrics.ContextAwareMeter; | ||
| import org.apache.gobblin.metrics.MetricContext; | ||
| import org.apache.gobblin.metrics.ServiceMetricNames; | ||
| import org.apache.gobblin.runtime.api.DagActionStore; | ||
| import org.apache.gobblin.runtime.api.MultiActiveLeaseArbiter; | ||
| import org.apache.gobblin.runtime.api.MysqlMultiActiveLeaseArbiter; | ||
|
|
@@ -94,10 +95,12 @@ public void handleTriggerEvent(Properties jobProps, DagActionStore.DagAction flo | |
| throws IOException { | ||
| if (multiActiveLeaseArbiter.isPresent()) { | ||
| MultiActiveLeaseArbiter.LeaseAttemptStatus leaseAttemptStatus = multiActiveLeaseArbiter.get().tryAcquireLease(flowAction, eventTimeMillis); | ||
| // TODO: add a log event or metric for each of these cases | ||
| if (leaseAttemptStatus instanceof MultiActiveLeaseArbiter.LeaseObtainedStatus) { | ||
| MultiActiveLeaseArbiter.LeaseObtainedStatus leaseObtainedStatus = (MultiActiveLeaseArbiter.LeaseObtainedStatus) leaseAttemptStatus; | ||
| this.metricContext.contextAwareCounter(ServiceMetricNames.FLOW_TRIGGER_HANDLER_LEASE_OBTAINED_COUNT); | ||
| if (persistFlowAction(leaseObtainedStatus)) { | ||
| log.info("Successfully persisted lease: [%s, eventTimestamp: %s] ", leaseObtainedStatus.getFlowAction(), | ||
| leaseObtainedStatus.getEventTimestamp()); | ||
| return; | ||
| } | ||
| // If persisting the flow action failed, then we set another trigger for this event to occur immediately to | ||
|
|
@@ -107,10 +110,12 @@ public void handleTriggerEvent(Properties jobProps, DagActionStore.DagAction flo | |
| eventTimeMillis); | ||
| return; | ||
| } else if (leaseAttemptStatus instanceof MultiActiveLeaseArbiter.LeasedToAnotherStatus) { | ||
| this.metricContext.contextAwareCounter(ServiceMetricNames.FLOW_TRIGGER_HANDLER_LEASED_TO_ANOTHER_COUNT); | ||
|
Contributor
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. do you want to add logs here for now for the other cases as well? Maybe they can be debug level logs
Contributor
Author
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. I wanted to but then realized that we do spit out some logs as part of this method |
||
| scheduleReminderForEvent(jobProps, (MultiActiveLeaseArbiter.LeasedToAnotherStatus) leaseAttemptStatus, | ||
| eventTimeMillis); | ||
| return; | ||
| } else if (leaseAttemptStatus instanceof MultiActiveLeaseArbiter.NoLongerLeasingStatus) { | ||
| this.metricContext.contextAwareCounter(ServiceMetricNames.FLOW_TRIGGER_HANDLER_NO_LONGER_LEASING_COUNT); | ||
| return; | ||
| } | ||
| throw new RuntimeException(String.format("Received type of leaseAttemptStatus: %s not handled by this method", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall flow of creating and using these metrics should be
Here you are creating a new one every time you mean to actually increment it. For ex:
gobblin/gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/DagActionStoreChangeMonitor.java
Line 113 in 4a9dd53
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a different idea in mind since I only wanted to check if the
FlowTriggerHandlergets different types of statuses or not. But I guess initializing at class level andinc()the counter will help gauge if the traffic distribution is happening uniformly between the hosts or not!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline and agreed the counter will provide more information about load balancing and relative amount of occurrence of each case