Skip to content

Commit

Permalink
trying
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachel Chen authored and Rachel Chen committed Feb 5, 2025
1 parent 1f4f3a7 commit 0383292
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions snuba/web/rpc/v1/resolvers/R_eap_spans/resolver_get_trace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid
from datetime import datetime
from operator import attrgetter
from typing import Any, Dict, Iterable

Expand Down Expand Up @@ -88,7 +89,9 @@ def _build_query(request: GetTraceRequest) -> Query:
]
selected_columns.extend(
[
SelectedExpression(name=col_name, expression=column(col_name))
SelectedExpression(
name=col_name, expression=column(col_name, alias=col_name)
)
for col_name in [
"organization_id",
"project_id",
Expand Down Expand Up @@ -192,14 +195,14 @@ def _value_to_attribute(key: str, value: Any) -> tuple[AttributeKey, AttributeVa
val_double=value,
),
)
elif isinstance(value, str):
elif isinstance(value, str) or isinstance(value, datetime):
return (
AttributeKey(
name=key,
type=AttributeKey.Type.TYPE_STRING,
),
AttributeValue(
val_str=value,
val_str=str(value),
),
)
else:
Expand Down
4 changes: 3 additions & 1 deletion tests/web/rpc/v1/test_endpoint_get_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ def test_with_data(self, setup_teardown: Any) -> None:
),
],
)
assert MessageToDict(response) == MessageToDict(expected_response)
assert MessageToDict(response.item_groups[0]) == MessageToDict(
expected_response.item_groups[0]
)

def test_with_specific_attributes(self, setup_teardown: Any) -> None:
ts = Timestamp(seconds=int(_BASE_TIME.timestamp()))
Expand Down

0 comments on commit 0383292

Please sign in to comment.