-
-
Notifications
You must be signed in to change notification settings - Fork 207
Refactor span storage #817
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
Refactor span storage #817
Conversation
609deb2 to
e32e392
Compare
|
@whatyouhide refactored with the genserver added. Left a comment wondering if we should sweep based on ttl or something else to avoid build up. @solnic I have two failing test that I'm confused about.. 1) test sends captured spans as transactions with child spans (Sentry.Opentelemetry.SpanProcessorTest)
test/sentry/opentelemetry/span_processor_test.exs:59
** (FunctionClauseError) no function clause matching in Calendar.ISO.parse_utc_datetime/2
The following arguments were given to Calendar.ISO.parse_utc_datetime/2:
# 1
nil
# 2
:extended
Attempted function clauses (showing 1 out of 1):
def parse_utc_datetime(string, format) when is_binary(string) and (format === :basic or format === :extended)
code: assert_valid_iso8601(transaction.timestamp)
stacktrace:
(elixir 1.17.2) lib/calendar/iso.ex:591: Calendar.ISO.parse_utc_datetime/2
(elixir 1.17.2) lib/calendar/datetime.ex:1233: DateTime.from_iso8601/3
test/sentry/opentelemetry/span_processor_test.exs:112: Sentry.Opentelemetry.SpanProcessorTest.assert_valid_iso8601/1
test/sentry/opentelemetry/span_processor_test.exs:67: (test)
Thoughts? |
| @impl true | ||
| def init(nil) do | ||
| _table = | ||
| if :ets.whereis(@table) == :undefined do |
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.
If the table is tied to this GenServer, where would we ever have the table running without it that we need this check?
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.
When testing, an error is thrown because the table is already created. We do this in check_in_id_mappings.ex as well.
|
|
||
| @root_spans_table :sentry_root_spans | ||
| @child_spans_table :sentry_child_spans | ||
| @table :span_storage |
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.
Scope this to Sentry, as the ETS namespace is global. My suggestion is
| @table :span_storage | |
| @table __MODULE__ |
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.
In one of our pairing sessions for check_in_id_mappings.ex, we discussed this being bad practice to have both the GenServer and the table name the same. Thoughts?
I'm looking into this finally. Sorry for late reply! |
|
@savhappy fixed tests via 2053408 @whatyouhide could you take another look please? would be good to merge this into the main PR branch and continue working there and wrap this up :) I'm sorry that it took me so long to follow-up here! |
4d2837b
into
solnic/support-for-transactions-via-otel
* initial refactor with ETS for span storage * add genserver back * Fix updating root spans in ets * remove comment --------- Co-authored-by: Peter Solnica <[email protected]>
* initial refactor with ETS for span storage * add genserver back * Fix updating root spans in ets * remove comment --------- Co-authored-by: Peter Solnica <[email protected]>
* initial refactor with ETS for span storage * add genserver back * Fix updating root spans in ets * remove comment --------- Co-authored-by: Peter Solnica <[email protected]>
[ WIP] Needs test adjustment and specs
Considerations:
Should we store root spans and child spans in separate tables?
Storing key/values like this -> parent:
{{:root_span, span_id}, span}child:{parent_span_id, span}Should we implement some sort of sweep in case spans don't get removed
on_endShould we order the child spans in the table? Or have an inserted_at value?