-
Couldn't load subscription status.
- Fork 829
JAV-416 expose and publish metrics using servo #272
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
Conversation
| protected void scheduleInvocation() { | ||
| OperationMeta operationMeta = restOperationMeta.getOperationMeta(); | ||
| try { | ||
| Object[] args = RestCodec.restToArgs(requestEx, restOperationMeta); |
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.
this moved decode from executor to netThread, not so good.
prepareStartTimeMetrics only care about time and qualifiedName, qualifiedName can be got from operationMeta
prepareStartTimeMetrics can return a metrics object, and then save it to invocation in runOnExecutor.
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.
fixed
|
|
||
| restProducerInvocation.runOnExecutor(); | ||
|
|
||
| restProducerInvocation.scheduleInvocation(); |
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.
infact, runOnExecutor triggered by scheduleInvocation
why invoke scheduleInvocation after runOnExecutor
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.
fixed
|
|
||
| private AtomicLong queueStartTime = new AtomicLong(); | ||
|
|
||
| private AtomicLong endOpertime = new AtomicLong(); |
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.
Time
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.
Fixed
|
|
||
| private AtomicLong endOpertime = new AtomicLong(); | ||
|
|
||
| private AtomicLong queueEndtime = new AtomicLong(); |
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.
Time
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.
Fixed
| * Returns the time when the operation ends. | ||
| * @return long | ||
| */ | ||
| public long getEndOpertime() { |
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.
Time
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.
Fixed
| * Returns the time when it leaves the queue. | ||
| * @return long | ||
| */ | ||
| public long getQueueEndtime() { |
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.
Time
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.
Fixed
| * Sets the time when it leaves the queue. | ||
| * @param endtime Leaving time from queue | ||
| */ | ||
| public void setQueueEndtime(long endtime) { |
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.
Time
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.
Fixed
| /* list of monitors */ | ||
| List<Monitor<?>> monitors = getMetricsMonitors(); | ||
|
|
||
| MonitorConfig commandMetricsConfig = MonitorConfig.builder("CSE_" + "test name").build(); |
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.
test name?
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.
this is fixed
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.
Please keep sending the changes in this PR.
| this.invocation = InvocationFactory.forProvider(transport.getEndpoint(), | ||
| restOperationMeta.getOperationMeta(), | ||
| args); | ||
| MetricsDataMonitorUtil.prepareStartTimeMetrics(invocation); |
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.
why static call everywhere? it makes metrics implementation coupled with each module in which it's used.
not only unit testing has to involve metrics implementation, but also it makes switching underlying metrics implementation nearly impossible
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.
fixed
| reqQueue.getTotalTime().addAndGet(timeInqueue); | ||
| reqQueue.incrementTotalCount(); | ||
|
|
||
| double avgTimeInQueue = reqQueue.getTotalTime().get() / reqQueue.getTotalCount().get(); |
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.
avg metrics can calculate once per cycle.
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.
fixed
| double avgTimeInQueue = reqQueue.getTotalTime().get() / reqQueue.getTotalCount().get(); | ||
|
|
||
| // store average,min and max times in operation level first. | ||
| QueueMetrics requestMetricQueue = MetricsDataMonitor.getMetricsGlobalRef().getQueueMetrics(operPath); |
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.
concurrence problem?
and minTime/maxTime also have the problem?
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.
fixed
| */ | ||
| public class MetricsServoRegistry implements InitializingBean { | ||
|
|
||
| private static final String METRICS_POLL_TIME = "cse.metrics.polltime"; |
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.
may declare time unit like "cse.metrics.polltime.second"
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.
its better to use only cse.metrics.polltime as using unit value in key is not good , as later we can support other time units also
| String fileName = DynamicPropertyFactory.getInstance().getStringProperty(FILENAME, "metrics").get(); | ||
| String filePath = DynamicPropertyFactory.getInstance().getStringProperty(FILEPATH, ".").get(); | ||
|
|
||
| MetricObserver fileObserver = new FileMetricObserver(fileName, new File(filePath)); |
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.
it's likely max,min and avg would never be reset ,I think they calculate latest 5min or 10min (can set) samples in a time window may better
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.
as of now support only one poll cycle , later we will support multiple cycles so that different rolling cycles can be supported as per user configuration
| } | ||
| requestMetricQueue.setAvgLifeTimeAfterQueue(avgWorkTimeAfterQueue); | ||
|
|
||
| double avgServiceExecTimeInstance = metricRef.getTotalServExecutionTime().get() |
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.
long must convert to double before division , please check all submit
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.
fixed
| metricsRef.incrementTotalReqProvider(); | ||
| // note down metrics for operational level. | ||
| metricsRef.setOperMetTotalReq(operPath, | ||
| metricsRef.getOperMetTotalReq(operPath) == null ? 1L : metricsRef.getOperMetTotalReq(operPath) + 1); |
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.
may concurrence problem ?
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.
fixed
| tpsAndLatencyMap.put("TPS-" + operPath, String.valueOf(tpsOper)); | ||
| tpsAndLatencyMap.put("Latency-" + operPath, String.valueOf(operLatency)); | ||
| insTotalTps += tpsOper; | ||
| insTotalLatency += operLatency; |
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 think we can not direct plus all latency together,may plus (operLatency * rolling count percentage ) as result
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.
fixed
|
i had rebase to lastest master , resolve conflict and fix unit test , new PR at #292 |
No description provided.