Skip to content
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

fix(eap-api): Snuba receives and returns doubles, while still supporting floats #6782

Merged
merged 11 commits into from
Jan 22, 2025

Conversation

xurui-c
Copy link
Member

@xurui-c xurui-c commented Jan 16, 2025

https://github.com/getsentry/eap-planning/issues/148

Update plan:

  1. Sentry can receive doubles and floats
  2. Snuba can receive (from Sentry) and return (to Sentry) doubles and floats. In the case of aggregation, replace float with double. This is fine because Sentry handles the case of receiving doubles already
  3. Sentry asks for doubles only

This PR addresses step 2. Step 1's PR is here: getsentry/sentry#83566

For every test that involved floats, I added a corresponding test with doubles. It ensures backward compatibility by verifying that Snuba can handle both floats and doubles

@xurui-c xurui-c changed the title c fix(eap-api): get Snuba ready to support val_double and val_float Jan 16, 2025
@xurui-c xurui-c force-pushed the rachel/doublesbackwardcompatible branch from 3f05554 to ecc5a6b Compare January 16, 2025 07:40
Copy link

codecov bot commented Jan 16, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2745 1 2744 11
View the top 1 failed tests by shortest run time
tests.web.rpc.v1.test_endpoint_get_traces.TestGetTraces::test_with_data_and_aggregated_fields_backward_compat
Stack Traces | 0.363s run time
Traceback (most recent call last):
  File ".../rpc/v1/test_endpoint_get_traces.py", line 455, in test_with_data_and_aggregated_fields_backward_compat
    assert MessageToDict(response) == MessageToDict(expected_response)
AssertionError: assert {'meta': {'requestId': '58f4182a8863476e86abc81598d0c464'},\n 'pageToken': {'offset': '10'},\n 'traces': [{'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '1a49ed5445eb4d0db2bc941593789029'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737479340.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '55b0eff9a2384936835c33e922c7ab15'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737479280.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'a8c0847d789b463da281f7277f7d5b61'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737479220.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'a1656a59dd914f1f8dbb126d479bc654'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737479160.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '8be002f4a02341acb37fd57bd97538c5'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737479100.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'cb968f516d1848928f072edfd3202d99'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737479040.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '83075a7d85a54753b0f265a25f1fd67b'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737478980.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '68bfa7ff92b84b79b959fb9df2003136'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737478920.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '539ac13af7444d6789a78b022ffb89a9'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737478860.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'cbfe804245da4146a022147ac24de5a5'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_DOUBLE',\n                             'value': {'valDouble': 1737478800.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]}]} == {'meta': {'requestId': '58f4182a8863476e86abc81598d0c464'},\n 'pageToken': {'offset': '10'},\n 'traces': [{'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '1a49ed5445eb4d0db2bc941593789029'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737479300.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '55b0eff9a2384936835c33e922c7ab15'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737479300.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'a8c0847d789b463da281f7277f7d5b61'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737479200.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'a1656a59dd914f1f8dbb126d479bc654'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737479200.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '8be002f4a02341acb37fd57bd97538c5'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737479000.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'cb968f516d1848928f072edfd3202d99'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737479000.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '83075a7d85a54753b0f265a25f1fd67b'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737479000.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '68bfa7ff92b84b79b959fb9df2003136'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737478900.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': '539ac13af7444d6789a78b022ffb89a9'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737478900.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]},\n            {'attributes': [{'key': 'KEY_TRACE_ID',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'cbfe804245da4146a022147ac24de5a5'}},\n                            {'key': 'KEY_START_TIMESTAMP',\n                             'type': 'TYPE_FLOAT',\n                             'value': {'valFloat': 1737478800.0}},\n                            {'key': 'KEY_TOTAL_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '12'}},\n                            {'key': 'KEY_FILTERED_ITEM_COUNT',\n                             'type': 'TYPE_INT',\n                             'value': {'valInt': '11'}},\n                            {'key': 'KEY_ROOT_SPAN_NAME',\n                             'type': 'TYPE_STRING',\n                             'value': {'valStr': 'root'}}]}]}
  Common items:
  {'meta': {'requestId': '58f4182a8863476e86abc81598d0c464'},
   'pageToken': {'offset': '10'}}
  Differing items:
  {'traces': [{'attributes': [{'key': 'KEY_TRACE_ID', 'type': 'TYPE_STRING', 'value': {'valStr': '1a49ed5445eb4d0db2bc94... 'value': {'valInt': '11'}}, {'key': 'KEY_ROOT_SPAN_NAME', 'type': 'TYPE_STRING', 'value': {'valStr': 'root'}}]}, ...]} != {'traces': [{'attributes': [{'key': 'KEY_TRACE_ID', 'type': 'TYPE_STRING', 'value': {'valStr': '1a49ed5445eb4d0db2bc94... 'value': {'valInt': '11'}}, {'key': 'KEY_ROOT_SPAN_NAME', 'type': 'TYPE_STRING', 'value': {'valStr': 'root'}}]}, ...]}
  Full diff:
    {
     'meta': {'requestId': '58f4182a8863476e86abc81598d0c464'},
     'pageToken': {'offset': '10'},
     'traces': [{'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': '1a49ed5445eb4d0db2bc941593789029'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737479300.0}},
  ?                                            ^ ^^^           ^
  +                              'value': {'valDouble': 1737479340.0}},
  ?                                            ^^^^ ^           ^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': '55b0eff9a2384936835c33e922c7ab15'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737479300.0}},
  ?                                            ^ ^^^          ^^
  +                              'value': {'valDouble': 1737479280.0}},
  ?                                            ^^^^ ^          ^^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'a8c0847d789b463da281f7277f7d5b61'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737479200.0}},
  ?                                            ^ ^^^           ^
  +                              'value': {'valDouble': 1737479220.0}},
  ?                                            ^^^^ ^           ^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'a1656a59dd914f1f8dbb126d479bc654'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737479200.0}},
  ?                                            ^ ^^^          ^^
  +                              'value': {'valDouble': 1737479160.0}},
  ?                                            ^^^^ ^          ^^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': '8be002f4a02341acb37fd57bd97538c5'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737479000.0}},
  ?                                            ^ ^^^          ^
  +                              'value': {'valDouble': 1737479100.0}},
  ?                                            ^^^^ ^          ^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'cb968f516d1848928f072edfd3202d99'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737479000.0}},
  ?                                            ^ ^^^           ^
  +                              'value': {'valDouble': 1737479040.0}},
  ?                                            ^^^^ ^           ^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': '83075a7d85a54753b0f265a25f1fd67b'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737479000.0}},
  ?                                            ^ ^^^          ^^
  +                              'value': {'valDouble': 1737478980.0}},
  ?                                            ^^^^ ^         + ^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': '68bfa7ff92b84b79b959fb9df2003136'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737478900.0}},
  ?                                            ^ ^^^           ^
  +                              'value': {'valDouble': 1737478920.0}},
  ?                                            ^^^^ ^           ^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': '539ac13af7444d6789a78b022ffb89a9'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737478900.0}},
  ?                                            ^ ^^^          ^^
  +                              'value': {'valDouble': 1737478860.0}},
  ?                                            ^^^^ ^          ^^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]},
                {'attributes': [{'key': 'KEY_TRACE_ID',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'cbfe804245da4146a022147ac24de5a5'}},
                                {'key': 'KEY_START_TIMESTAMP',
  -                              'type': 'TYPE_FLOAT',
  ?                                            ^ ^^^
  +                              'type': 'TYPE_DOUBLE',
  ?                                            ^^^^ ^
  -                              'value': {'valFloat': 1737478800.0}},
  ?                                            ^ ^^^
  +                              'value': {'valDouble': 1737478800.0}},
  ?                                            ^^^^ ^
                                {'key': 'KEY_TOTAL_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '12'}},
                                {'key': 'KEY_FILTERED_ITEM_COUNT',
                                 'type': 'TYPE_INT',
                                 'value': {'valInt': '11'}},
                                {'key': 'KEY_ROOT_SPAN_NAME',
                                 'type': 'TYPE_STRING',
                                 'value': {'valStr': 'root'}}]}],
    }

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@xurui-c xurui-c force-pushed the rachel/doublesbackwardcompatible branch 2 times, most recently from 9ce32e8 to 8ecee4e Compare January 16, 2025 08:28
@xurui-c xurui-c changed the title fix(eap-api): get Snuba ready to support val_double and val_float fix(eap-api): Snuba receives and returns doubles Jan 16, 2025
@xurui-c xurui-c force-pushed the rachel/doublesbackwardcompatible branch 2 times, most recently from c15bab2 to 8f6cca1 Compare January 17, 2025 19:57
@xurui-c xurui-c force-pushed the rachel/doublesbackwardcompatible branch 2 times, most recently from 6b756f9 to 08e2ece Compare January 17, 2025 20:48
@xurui-c xurui-c force-pushed the rachel/doublesbackwardcompatible branch from 08e2ece to 628c371 Compare January 17, 2025 21:21
@xurui-c xurui-c force-pushed the rachel/doublesbackwardcompatible branch from 3a96a04 to b7259e9 Compare January 20, 2025 23:08
@xurui-c xurui-c changed the title fix(eap-api): Snuba receives and returns doubles fix(eap-api): Snuba receives and returns doubles, while still supporting floats Jan 20, 2025
snuba/web/rpc/v1/endpoint_get_traces.py Outdated Show resolved Hide resolved
@@ -37,6 +37,8 @@

CUSTOM_COLUMN_PREFIX = "__snuba_custom_column__"

_FLOATING_POINT_PRECISION = 8
Copy link
Contributor

Choose a reason for hiding this comment

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

A Float32 would provide us with at least 8 digits of precision already I think, we should extend that to 12 if we're going to support Float64.

@kylemumma
Copy link
Member

Hi I don't really understand what exactly you're trying to do so im finding it hard to review. Do you mind adding more context behind the PR to the description?

@xurui-c xurui-c force-pushed the rachel/doublesbackwardcompatible branch from ef01b9a to adc9455 Compare January 21, 2025 21:11
@xurui-c xurui-c marked this pull request as ready for review January 21, 2025 22:23
@xurui-c xurui-c requested review from a team as code owners January 21, 2025 22:23
Function.FUNCTION_P99: cf.quantile(0.99)(field, **alias_dict),
Function.FUNCTION_AVG: f.avg(field, **alias_dict),
Function.FUNCTION_P50: f.round(
cf.quantile(0.5)(field), _FLOATING_POINT_PRECISION, **alias_dict
Copy link
Member

Choose a reason for hiding this comment

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

why do you need to add this _FLOATING_POINT_PRECISION argument?

Copy link
Member Author

Choose a reason for hiding this comment

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

We still have floating point precision errors :(

@xurui-c xurui-c merged commit caddadc into master Jan 22, 2025
31 checks passed
@xurui-c xurui-c deleted the rachel/doublesbackwardcompatible branch January 22, 2025 08:48
xurui-c added a commit to getsentry/sentry that referenced this pull request Jan 23, 2025
#83814)

Update plan:

1. Sentry can receive doubles and floats
2. Snuba can receive (from Sentry) and return (to Sentry) doubles and
floats. In the case of aggregation, replace float with double. This is
fine because Sentry handles the case of receiving doubles already
3. Sentry asks for doubles only
This PR addresses step 3. Step 2's PR is here:
getsentry/snuba#6782

Note to self: don't merge until step 2's PR is fully deployed

---------

Co-authored-by: Rachel Chen <[email protected]>
andrewshie-sentry pushed a commit to getsentry/sentry that referenced this pull request Jan 29, 2025
#83814)

Update plan:

1. Sentry can receive doubles and floats
2. Snuba can receive (from Sentry) and return (to Sentry) doubles and
floats. In the case of aggregation, replace float with double. This is
fine because Sentry handles the case of receiving doubles already
3. Sentry asks for doubles only
This PR addresses step 3. Step 2's PR is here:
getsentry/snuba#6782

Note to self: don't merge until step 2's PR is fully deployed

---------

Co-authored-by: Rachel Chen <[email protected]>
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.

4 participants