Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Changes for duration from milli to micro #32

Open
wants to merge 14 commits into
base: rzp_main
Choose a base branch
from

Conversation

TriptiTripathi1234
Copy link

Duration is in milli second currently. Changes are done to change in to micro seconds.

@TriptiTripathi1234 TriptiTripathi1234 changed the title Changes for duration from milli to micro WIP: Changes for duration from milli to micro Aug 24, 2022
Copy link

@suddendust suddendust left a comment

Choose a reason for hiding this comment

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

Please add the appropriate test cases.

@@ -18,7 +18,7 @@ pinot.controllerPort = 9000
pinot.timeColumn = start_time_millis
pinot.timeUnit = MILLISECONDS
# todo: Add Attributes and Metrics after adding map type value
pinot.dimensionColumns = [tenant_id, span_kind, error_count, exception_count, duration_millis, end_time_millis, api_name, service_name, span_id, trace_id, protocol_name, status_code, service_id, api_id, num_calls, api_discovery_state, space_ids]
pinot.dimensionColumns = [tenant_id, span_kind, error_count, exception_count, duration_millis, duration_micros, end_time_millis, api_name, service_name, span_id, trace_id, protocol_name, status_code, service_id, api_id, num_calls, api_discovery_state, space_ids]

Choose a reason for hiding this comment

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

why do we need this duration in micro across views, I think as per my understanding, only the span event view needed that (and the backend entity view).

Choose a reason for hiding this comment

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

@Sunn-y-Arora I think it's better to have this consistently across all views.

Choose a reason for hiding this comment

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

not required right? raw-service (for eg) view gives service ka overall rsp time, it will never be in micro, so unnecessary change

Choose a reason for hiding this comment

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

True but why have two different units in two different views? We'll anyway get rid of duration_millis across all tables, if extra storage and indexing cost is a concern. This also makes code the query side simpler, as it doesn't have to differentiate b/w the two columns IMO.

Copy link
Author

Choose a reason for hiding this comment

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

As pointed out by Prashant, added it in micro across views so that all the views have consistency.

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2022

Codecov Report

❗ No coverage uploaded for pull request base (rzp_main@158eb5a). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 68065ea differs from pull request most recent head 553a85f. Consider uploading reports for the commit 553a85f to get more accurate results

@@             Coverage Diff             @@
##             rzp_main      #32   +/-   ##
===========================================
  Coverage            ?   79.45%           
  Complexity          ?     1311           
===========================================
  Files               ?      118           
  Lines               ?     5271           
  Branches            ?      481           
===========================================
  Hits                ?     4188           
  Misses              ?      865           
  Partials            ?      218           
Flag Coverage Δ
unit 79.45% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@TriptiTripathi1234 TriptiTripathi1234 force-pushed the change_duration_from_milli_to_micro branch from e325c64 to a2e6974 Compare August 30, 2022 11:01
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@TriptiTripathi1234
Copy link
Author

Please add the appropriate test cases.

added @suddendust

@TriptiTripathi1234 TriptiTripathi1234 changed the title WIP: Changes for duration from milli to micro Changes for duration from milli to micro Sep 6, 2022
@@ -24,6 +24,9 @@ protocol BackendEntityViewProtocol {

long duration_millis = 0;

// duration micro
double duration_micros = 0;

Choose a reason for hiding this comment

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

This can be long?

Copy link
Author

Choose a reason for hiding this comment

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

As per our discussion, we went with double to store all the significant digits(might need in future). Making it LONG will defeat this purpose.

Choose a reason for hiding this comment

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

Long's upper limit is 9223372036854775807, which is equal to 292471.20867753599305 years. Do you think a span's duration will exceed this value?

Copy link
Author

Choose a reason for hiding this comment

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

we are talking about significant digits, not the range

Copy link
Author

@TriptiTripathi1234 TriptiTripathi1234 Sep 6, 2022

Choose a reason for hiding this comment

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

let's say we have .123 ms that would be 0ms(in LONG), 123 micro seconds(LONG).
Now if we have .1234ms that would be 123 micro seconds(if LONG), 123.4 micro seconds(if DOUBLE). Isnt it?

Choose a reason for hiding this comment

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

Aren't we solving for microsecond granularity? It means the smallest duration we can report is 1µ. So 123.4 µs should be rounded off to 123 µs. This will keep things on the query layer simples as you wouldn't have to deal with converting data types.

Copy link
Author

Choose a reason for hiding this comment

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

As per discussion with team and tech specs I have added datatype as DOUBLE

@@ -18,6 +18,9 @@ protocol RawServiceViewProtocol {

long duration_millis;

// duration micro
double duration_micros = 0;

Choose a reason for hiding this comment

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

Same

@@ -88,6 +88,7 @@ private BackendEntityView.Builder generateViewBuilder(
builder.setStartTimeMillis(event.getStartTimeMillis());
builder.setEndTimeMillis(event.getEndTimeMillis());
builder.setDurationMillis(event.getEndTimeMillis() - event.getStartTimeMillis());
builder.setDurationMicros(event.getMetrics().getMetricMap().get("Duration").getValue());

Choose a reason for hiding this comment

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

Move this to constants, or reuse if this is already defined.

@@ -50,6 +50,7 @@ List<RawServiceView> generateView(
builder.setStartTimeMillis(event.getStartTimeMillis());
builder.setEndTimeMillis(event.getEndTimeMillis());
builder.setDurationMillis(event.getEndTimeMillis() - event.getStartTimeMillis());
builder.setDurationMicros(event.getMetrics().getMetricMap().get("Duration").getValue());

Choose a reason for hiding this comment

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

Same

@@ -367,7 +367,9 @@ private Event buildEvent(
Map<String, MetricValue> metricMap = new HashMap<>();
MetricValue durationMetric =
fastNewBuilder(MetricValue.Builder.class)
.setValue((double) (endTimeMillis - startTimeMillis))
.setValue(

Choose a reason for hiding this comment

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

Also a test case for this?

Copy link
Author

Choose a reason for hiding this comment

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

added

Copy link

@suddendust suddendust left a comment

Choose a reason for hiding this comment

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

LGTM, requesting minor changes.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@TriptiTripathi1234 TriptiTripathi1234 force-pushed the change_duration_from_milli_to_micro branch from 1f91e69 to e249e33 Compare September 19, 2022 13:53
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@TriptiTripathi1234 TriptiTripathi1234 force-pushed the change_duration_from_milli_to_micro branch from 35c64eb to 272e8a3 Compare September 21, 2022 06:57
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link

Unit Test Results

  76 files  ±0    76 suites  ±0   1m 9s ⏱️ -1s
398 tests ±0  396 ✔️ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 68065ea. ± Comparison against base commit 92601e7.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants