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

NH-34752 Parse txn filters and calculate tracing mode #136

Merged
merged 12 commits into from
Apr 25, 2023

Conversation

tammy-baylis-swi
Copy link
Contributor

@tammy-baylis-swi tammy-baylis-swi commented Apr 21, 2023

This is more steps towards implementing transaction filtering:

  1. Update update_transaction_filters in the Configurator to use existing helper OboeTracingMode.get_oboe_trace_mode to map filter's tracing to int for liboboe
  2. Also more checks for valid filter's regex values
  3. Adds calculate_tracing_mode used by sampler to apply per-request filter or "global" tracing_mode that can also be configured.

This only filters for span <kind>:<name> right now because http.* attributes generated by instrumentation libraries are not yet available to the sampler, but this is gradually being implemented in OTel #936.

Example basic config file JSON I'm using with Django A:

{
    "tracingMode": "enabled",
    "transactionSettings": [
        {
            "regex": "SERVER:another/",
            "tracing": "disabled"
        },
    ]
}

Next PRs:

Please let me know if any questions/suggestions!

@tammy-baylis-swi tammy-baylis-swi marked this pull request as ready for review April 21, 2023 23:31
@tammy-baylis-swi tammy-baylis-swi requested a review from a team April 21, 2023 23:31
@@ -2,17 +2,22 @@

from solarwinds_apm.sampler import _SwSampler

def side_effect_fn(param):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
continue

try:
re.compile(filter["regex"])
Copy link
Member

@raphael-theriault-swi raphael-theriault-swi Apr 21, 2023

Choose a reason for hiding this comment

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

Since you're already compiling the regex in here wouldn't it make sense to store the result in txn_filter so it doesn't have to get recompiled on every match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Changed in d28c040.

Copy link
Member

@raphael-theriault-swi raphael-theriault-swi left a comment

Choose a reason for hiding this comment

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

Looks good !

@tammy-baylis-swi tammy-baylis-swi merged commit 8438b3a into main Apr 25, 2023
@tammy-baylis-swi tammy-baylis-swi deleted the NH-34752-txn-filters-and-tracing-mode branch April 25, 2023 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants