Skip to content

Commit b6b2eeb

Browse files
authored
Merge branch 'master' into gh_actions_unit_tests
2 parents 98867df + 3c1218e commit b6b2eeb

File tree

8 files changed

+28
-8
lines changed

8 files changed

+28
-8
lines changed

.github/workflows/IntegrationTesting.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
cleanup:
141141
name: Resource tear down
142142
needs: test_WebApp
143-
if: true
143+
if: always()
144144
runs-on: ubuntu-latest
145145

146146
steps:
@@ -163,7 +163,7 @@ jobs:
163163
run: terraform init
164164

165165
- name: set permissions to terraform plugins
166-
run: chmod -R a+x .terraform/plugins/registry.terraform.io/hashicorp/aws/3.5.0/linux_amd64/*
166+
run: chmod -R a+x .terraform/*
167167

168168
- name: Destroy resources
169169
run: terraform destroy -state="terraform.tfstate" -var-file="fixtures.us-west-2.tfvars" -auto-approve

aws_xray_sdk/core/async_recorder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def capture_async(self, name=None):
5353

5454
def in_segment_async(self, name=None, **segment_kwargs):
5555
"""
56-
Return a segment async context manger.
56+
Return a segment async context manager.
5757
5858
:param str name: the name of the segment
5959
:param dict segment_kwargs: remaining arguments passed directly to `begin_segment`
@@ -62,7 +62,7 @@ def in_segment_async(self, name=None, **segment_kwargs):
6262

6363
def in_subsegment_async(self, name=None, **subsegment_kwargs):
6464
"""
65-
Return a subsegment async context manger.
65+
Return a subsegment async context manager.
6666
6767
:param str name: the name of the segment
6868
:param dict segment_kwargs: remaining arguments passed directly to `begin_segment`

aws_xray_sdk/core/plugins/ec2_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import json
22
import logging
33
from future.standard_library import install_aliases
4-
from urllib.request import urlopen, Request
5-
64
install_aliases()
75

6+
from urllib.request import urlopen, Request
7+
88
log = logging.getLogger(__name__)
99

1010
SERVICE_NAME = 'ec2'

aws_xray_sdk/core/recorder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class to have your own implementation of the streaming process.
184184

185185
def in_segment(self, name=None, **segment_kwargs):
186186
"""
187-
Return a segment context manger.
187+
Return a segment context manager.
188188
189189
:param str name: the name of the segment
190190
:param dict segment_kwargs: remaining arguments passed directly to `begin_segment`
@@ -193,7 +193,7 @@ def in_segment(self, name=None, **segment_kwargs):
193193

194194
def in_subsegment(self, name=None, **subsegment_kwargs):
195195
"""
196-
Return a subsegment context manger.
196+
Return a subsegment context manager.
197197
198198
:param str name: the name of the subsegment
199199
:param dict subsegment_kwargs: remaining arguments passed directly to `begin_subsegment`

aws_xray_sdk/ext/django/apps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def ready(self):
3030
daemon_address=settings.AWS_XRAY_DAEMON_ADDRESS,
3131
sampling=settings.SAMPLING,
3232
sampling_rules=settings.SAMPLING_RULES,
33+
sampler=settings.SAMPLER,
3334
context_missing=settings.AWS_XRAY_CONTEXT_MISSING,
3435
plugins=settings.PLUGINS,
3536
service=settings.AWS_XRAY_TRACING_NAME,

aws_xray_sdk/ext/django/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
'PLUGINS': (),
1111
'SAMPLING': True,
1212
'SAMPLING_RULES': None,
13+
'SAMPLER': None,
1314
'AWS_XRAY_TRACING_NAME': None,
1415
'DYNAMIC_NAMING': None,
1516
'STREAMING_THRESHOLD': None,

tests/ext/django/app/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Config file for a django app used by django testing client
33
"""
44
import os
5+
from aws_xray_sdk.core.sampling.sampler import LocalSampler
56

67

78
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -60,6 +61,7 @@
6061
XRAY_RECORDER = {
6162
'AWS_XRAY_TRACING_NAME': 'django',
6263
'SAMPLING': False,
64+
'SAMPLER': LocalSampler(),
6365
}
6466

6567
LANGUAGE_CODE = 'en-us'

tests/ext/django/test_settings.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from unittest import mock
2+
3+
import django
4+
from aws_xray_sdk import global_sdk_config
5+
from django.test import TestCase, override_settings
6+
from django.conf import settings
7+
from django.apps import apps
8+
9+
from aws_xray_sdk.core import xray_recorder
10+
from aws_xray_sdk.core.sampling.sampler import LocalSampler
11+
12+
13+
class XRayConfigurationTestCase(TestCase):
14+
def test_sampler_can_be_configured(self):
15+
assert isinstance(settings.XRAY_RECORDER['SAMPLER'], LocalSampler)
16+
assert isinstance(xray_recorder.sampler, LocalSampler)

0 commit comments

Comments
 (0)