Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions axiom/nr_txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,8 +1599,7 @@ void nr_txn_record_error(nrtxn_t* txn,
/* Only try to get a span_id in cases where we know spans should be created.
*/
if (nr_txn_should_create_span_events(txn)) {
span_id = nr_txn_get_current_span_id(
txn, nr_string_get(txn->trace_strings, txn->current_async_context));
span_id = nr_txn_get_current_span_id(txn, nr_txn_get_current_context(txn));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignore this, it is part of #1210.


/*
* The specification says span_id MUST be included so if span events are
Expand All @@ -1614,7 +1613,8 @@ void nr_txn_record_error(nrtxn_t* txn,
}

if (add_to_current_segment) {
current_segment = nr_txn_get_current_segment(txn, NULL);
current_segment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not part of this PR, it's part of #1210.

= nr_txn_get_current_segment(txn, nr_txn_get_current_context(txn));

if (current_segment) {
nr_segment_set_error(current_segment, errmsg, errclass);
Expand Down Expand Up @@ -1756,7 +1756,7 @@ nr_status_t nr_txn_add_user_custom_parameter(nrtxn_t* txn,
}

if (nr_txn_should_create_span_events(txn)) {
current = nr_txn_get_current_segment(txn, NULL);
current = nr_txn_get_current_segment(txn, nr_txn_get_current_context(txn));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not part of this PR, it's part of #1210.


nr_segment_attributes_user_txn_event_add(
current, NR_ATTRIBUTE_DESTINATION_SPAN, key, value);
Expand Down Expand Up @@ -3218,6 +3218,8 @@ nr_segment_t* nr_txn_get_current_segment(nrtxn_t* txn,
nr_hashmap_index_get(txn->parent_stacks, (uint64_t)async_context_idx));
}

/* This is ONLY ever set with non-OAPI and PHPs less than 8. Do not assume or
* use force_current_segment with PHPs >= 8.0 */
if (txn->force_current_segment) {
return txn->force_current_segment;
}
Expand Down
6 changes: 5 additions & 1 deletion axiom/nr_txn.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ typedef struct _nrtxn_t {
context */
nr_segment_t* force_current_segment; /* Enforce a current segment for the
default context, overriding the
default parent stack. */
default parent stack. Only used with
PHP < 8.0. Do no tuse with OAPI; it is
not setup to utilize this.*/
size_t segment_count; /* A count of segments for this transaction, maintained
throughout the life of this transaction */
nr_minmax_heap_t*
Expand Down Expand Up @@ -1101,6 +1103,8 @@ extern nr_segment_t* nr_txn_get_current_segment(nrtxn_t* txn,
*
* This function is useful to temporarily inject segments that don't
* use the default allocator.
* Note : This is ONLY ever set with non-OAPI and PHPs less than 8.0. Do not
* use with OAPI; it is not setup to utilize this.
*/
inline static void nr_txn_force_current_segment(nrtxn_t* txn,
nr_segment_t* segment) {
Expand Down
Loading