Skip to content

Conversation

@acsukesh
Copy link
Contributor

No description provided.

protected void scheduleInvocation() {
OperationMeta operationMeta = restOperationMeta.getOperationMeta();
try {
Object[] args = RestCodec.restToArgs(requestEx, restOperationMeta);
Copy link
Contributor

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.

Copy link
Contributor Author

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();
Copy link
Contributor

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

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time

Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time

Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time

Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time

Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time

Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fixed

Copy link
Member

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);
Copy link
Member

@seanyinx seanyinx Nov 17, 2017

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

Copy link
Contributor Author

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 86.961% when pulling 5bcc05b on acsukesh:master into 0bec82b on ServiceComb:master.

*/
public class MetricsServoRegistry implements InitializingBean {

private static final String METRICS_POLL_TIME = "cse.metrics.polltime";

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"

Copy link
Contributor Author

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));

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

Copy link
Contributor Author

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()

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

Copy link
Contributor Author

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may concurrence problem ?

Copy link
Contributor Author

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;

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@coveralls
Copy link

coveralls commented Nov 21, 2017

Coverage Status

Coverage increased (+0.3%) to 87.163% when pulling 38eb313 on acsukesh:master into 12207b5 on ServiceComb:master.

@zhengyangyong
Copy link

i had rebase to lastest master , resolve conflict and fix unit test , new PR at #292

@WillemJiang
Copy link
Member

WillemJiang commented Nov 22, 2017

The PR is merged into master branch by accident , now we can track the issue in #292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants