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

RD-11321-otel-distros-python-and-node-filter-out-empty-sqs-polls #481

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a960fc4
fix: pip install failed on mac
sagivoululumigo Sep 6, 2023
a063aa7
feat: do not export empty sqs polling spans
sagivoululumigo Sep 7, 2023
7b8613f
chore: auto format code
sagivoululumigo Sep 7, 2023
8aaa755
fix: pip install failed on mac
sagivoululumigo Sep 6, 2023
3ab36de
feat: do not export empty sqs polling spans
sagivoululumigo Sep 7, 2023
d69b6f5
chore: auto format code
sagivoululumigo Sep 7, 2023
24dbb03
test: bool env var retrival edge cases
sagivoululumigo Sep 7, 2023
d48e913
test: new span processor and empty sqs span skipping
sagivoululumigo Sep 7, 2023
40c68e8
chore: auto format code
sagivoululumigo Sep 7, 2023
220c47f
resolve merge conflict
sagivoululumigo Sep 7, 2023
ff1a6a1
fix: remove debugging prints
sagivoululumigo Sep 7, 2023
05f11d5
refactor: rename NO_EXPORT attribute to SKIP_EXPORT
sagivoululumigo Sep 10, 2023
efda5e9
fix: wrong attribute name used
sagivoululumigo Sep 10, 2023
88b4406
test: integration test empty sqs polling span skipping
sagivoululumigo Sep 10, 2023
73887b3
chore: fix linting errors
sagivoululumigo Sep 10, 2023
be82dde
fix: change skipping empty sqs poll log line to info
sagivoululumigo Sep 10, 2023
7b96321
fix: edge case env var with None value
sagivoululumigo Sep 10, 2023
65b9113
chore: auto format code
sagivoululumigo Sep 10, 2023
eeb8ce6
fix: change env var name to have lumigo prefix
sagivoululumigo Sep 10, 2023
fbdb95c
docs: update README.md with filter empty sqs messages feature
sagivoululumigo Sep 10, 2023
302dfb0
docs: detailed possible values for LUMIGO_AUTO_FILTER_EMPTY_SQS
sagivoululumigo Sep 10, 2023
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: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ The `lumigo_opentelemetry` package additionally supports the following configura
* We support more granular masking using the following parameters. If not given, the above configuration is the fallback: `LUMIGO_SECRET_MASKING_REGEX_HTTP_REQUEST_BODIES`, `LUMIGO_SECRET_MASKING_REGEX_HTTP_REQUEST_HEADERS`, `LUMIGO_SECRET_MASKING_REGEX_HTTP_RESPONSE_BODIES`, `LUMIGO_SECRET_MASKING_REGEX_HTTP_RESPONSE_HEADERS`, `LUMIGO_SECRET_MASKING_REGEX_HTTP_QUERY_PARAMS`, `LUMIGO_SECRET_MASKING_REGEX_ENVIRONMENT`.
* `LUMIGO_SWITCH_OFF=true`: This option disables the Lumigo OpenTelemetry distro entirely; no instrumentation will be injected, no tracing data will be collected.
* `LUMIGO_REPORT_DEPENDENCIES=false`: This option disables the built-in dependency reporting to Lumigo SaaS. For more information, refer to the [Automated dependency reporting](#automated-dependency-reporting) section.
* `LUMIGO_AUTO_FILTER_EMPTY_SQS`: This option enables the automatic filtering of empty SQS messages from being sent to Lumigo SaaS.
sagivoululumigo marked this conversation as resolved.
Show resolved Hide resolved

### Execution Tags

Expand Down Expand Up @@ -340,6 +341,15 @@ for message in response.get("Messages", []):

Without the scope provided by the iterator over `response["Messages"]`, `span_1` would be without a parent span, and that would result in a separate invocation and a separate transaction in Lumigo.

### Filtering out empty SQS messages

A common pattern in SQS-based applications is to continuously poll an SQS queue for messages,
and to process them as they arrive.
In order not to clutter the Lumigo Dashboard with empty SQS polling messages, the default behavior is to filter them
out from being sent to Lumigo.

You can change this behavior by setting the environment variable `LUMIGO_AUTO_FILTER_EMPTY_SQS` to `false`.

## Testing

We use [nox](https://pypi.org/project/nox/) for setting up and running our tests.
Expand Down
2 changes: 1 addition & 1 deletion src/lumigo_opentelemetry/libs/environment_variables.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
AUTO_FILTER_EMPTY_SQS = "AUTO_FILTER_EMPTY_SQS"
AUTO_FILTER_EMPTY_SQS = "LUMIGO_AUTO_FILTER_EMPTY_SQS"
2 changes: 1 addition & 1 deletion src/test/unit/instrumentations/botocore/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_sqs_skip_sqs_response(
env_var_value, operation, result, should_skip, monkeypatch
):
if env_var_value is not None:
monkeypatch.setenv("AUTO_FILTER_EMPTY_SQS", env_var_value)
monkeypatch.setenv("LUMIGO_AUTO_FILTER_EMPTY_SQS", env_var_value)

assert (
SqsParser._should_skip_empty_sqs_polling_response(operation, result)
Expand Down