Skip to content

Commit

Permalink
Merge branch 'main' into develop-8T-compress-batch
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino committed Feb 10, 2023
2 parents ef826cd + 6c06f9b commit 919754e
Show file tree
Hide file tree
Showing 25 changed files with 1,233 additions and 483 deletions.
28 changes: 28 additions & 0 deletions .github/scripts/retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Time in seconds to backoff after the initial attempt.
INITIAL_BACKOFF=10

# Grab first arg as number of retries
retries=$1
shift

# Use for loop to repeatedly try the wrapped command, breaking on success
for i in $(seq 1 $retries); do
echo "Running: $@"

# Exponential backoff
if [[ i -gt 1 ]]; then
# Starts with the initial backoff then doubles every retry.
backoff=$(($INITIAL_BACKOFF * (2 ** (i - 2))))
echo "Command failed, retrying in $backoff seconds..."
sleep $backoff
fi

# Run wrapped command, and exit on success
$@ && break
result=$?
done

# Exit with status code of wrapped command
exit $?
15 changes: 8 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
runs-on: ubuntu-20.04
needs:
- python
- elasticsearchserver01
- elasticsearchserver07
- elasticsearchserver08
- gearman
- grpc
- kafka
Expand Down Expand Up @@ -656,7 +656,7 @@ jobs:
path: ./**/.coverage.*
retention-days: 1

elasticsearchserver01:
elasticsearchserver07:
env:
TOTAL_GROUPS: 1

Expand All @@ -669,8 +669,8 @@ jobs:
timeout-minutes: 30

services:
es01:
image: elasticsearch:1.4.4
es07:
image: elasticsearch:7.17.8
env:
"discovery.type": "single-node"
ports:
Expand Down Expand Up @@ -708,7 +708,7 @@ jobs:
path: ./**/.coverage.*
retention-days: 1

elasticsearchserver07:
elasticsearchserver08:
env:
TOTAL_GROUPS: 1

Expand All @@ -721,9 +721,10 @@ jobs:
timeout-minutes: 30

services:
es01:
image: elasticsearch:7.13.2
es08:
image: elasticsearch:8.6.0
env:
"xpack.security.enabled": "false"
"discovery.type": "single-node"
ports:
- 8080:9200
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.DS_Store
.DS_Store/

# Linter
megalinter-reports/

Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,5 @@ We host a public Slack with a dedicated channel for contributors and
maintainers of open source projects hosted by New Relic. If you are
contributing to this project, you're welcome to request access to the
#oss-contributors channel in the newrelicusers.slack.com workspace. To
request access, see https://newrelicusers-signup.herokuapp.com/.
request access, please use this `link
<https://join.slack.com/t/newrelicusers/shared_invite/zt-1ayj69rzm-~go~Eo1whIQGYnu3qi15ng/>`__.
6 changes: 5 additions & 1 deletion newrelic/api/time_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ def _observe_exception(self, exc_info=None, ignore=None, expected=None, status_c
if is_expected is None and callable(expected):
is_expected = expected(exc, value, tb)

# Callable on transaction
if is_expected is None and hasattr(transaction, "_expect_errors"):
is_expected = transaction._expect_errors(exc, value, tb)

# List of class names
if is_expected is None and expected is not None and not callable(expected):
# Do not set is_expected to False
Expand Down Expand Up @@ -631,7 +635,7 @@ def get_service_linking_metadata(application=None, settings=None):
if application is None:
from newrelic.api.application import application_instance
application = application_instance(activate=False)

if application is not None:
settings = application.settings

Expand Down
87 changes: 85 additions & 2 deletions newrelic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2661,64 +2661,147 @@ def _process_module_builtin_defaults():
"aioredis.connection", "newrelic.hooks.datastore_aioredis", "instrument_aioredis_connection"
)

_process_module_definition("redis.asyncio.client", "newrelic.hooks.datastore_aioredis", "instrument_aioredis_client")
_process_module_definition(
"redis.asyncio.client", "newrelic.hooks.datastore_aioredis", "instrument_aioredis_client"
)

_process_module_definition("redis.asyncio.commands", "newrelic.hooks.datastore_aioredis", "instrument_aioredis_client")
_process_module_definition(
"redis.asyncio.commands", "newrelic.hooks.datastore_aioredis", "instrument_aioredis_client"
)

_process_module_definition(
"redis.asyncio.connection", "newrelic.hooks.datastore_aioredis", "instrument_aioredis_connection"
)

# v7 and below
_process_module_definition(
"elasticsearch.client",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.client.cat",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_cat",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client.cat",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_cat_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.client.cluster",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_cluster",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client.cluster",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_cluster_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.client.indices",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_indices",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client.indices",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_indices_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.client.nodes",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_nodes",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client.nodes",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_nodes_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.client.snapshot",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_snapshot",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client.snapshot",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_snapshot_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.client.tasks",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_tasks",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client.tasks",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_tasks_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.client.ingest",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_ingest",
)
# v8 and above
_process_module_definition(
"elasticsearch._sync.client.ingest",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_client_ingest_v8",
)

# v7 and below
_process_module_definition(
"elasticsearch.connection.base",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_connection_base",
)
# v8 and above
_process_module_definition(
"elastic_transport._node._base",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elastic_transport__node__base",
)

# v7 and below
_process_module_definition(
"elasticsearch.transport",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elasticsearch_transport",
)
# v8 and above
_process_module_definition(
"elastic_transport._transport",
"newrelic.hooks.datastore_elasticsearch",
"instrument_elastic_transport__transport",
)

_process_module_definition("pika.adapters", "newrelic.hooks.messagebroker_pika", "instrument_pika_adapters")
_process_module_definition("pika.channel", "newrelic.hooks.messagebroker_pika", "instrument_pika_channel")
Expand Down
Loading

0 comments on commit 919754e

Please sign in to comment.