Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
dfd6d4f
Bump version and Merge Changelog after 0.7.0 release (#740)
lzchen Aug 1, 2019
5831ba9
Add set_status to span, update pymongo integration (#738)
victoraugustolls Aug 2, 2019
0aa3f5a
Bump SD exporter package version for release (#747)
c24t Aug 5, 2019
36196f1
Skip existing packages on twine upload (#744)
c24t Aug 5, 2019
7f70b65
Update CHANGELOG and bump versions (#754)
lzchen Aug 6, 2019
86689fe
SD exporter and set_status release (#750)
c24t Aug 6, 2019
ab47474
Requests library spec fidelity (#746)
victoraugustolls Aug 6, 2019
577fb61
Update codeowners file (#756)
reyang Aug 7, 2019
49b27ef
Fixes value for `http.route` in Flask middleware (#759)
olance Aug 13, 2019
daecc37
Update GCP metadata URL (#761)
c24t Aug 15, 2019
479087c
0.7.2 release (#763)
c24t Aug 16, 2019
cde62c5
Standard Metrics - Incoming Requests Per Second (#758)
lzchen Aug 19, 2019
de131c7
Delete SD integ test metric descriptors (#770)
c24t Aug 20, 2019
52b974f
Hotfix/django flask pyramid status code (#755)
victoraugustolls Aug 21, 2019
a8c3415
Fixed requests contrib to raise original exceptions (#771)
victoraugustolls Aug 22, 2019
8e582cb
Standard Metrics - Incoming Requests Execution Time (#773)
lzchen Aug 27, 2019
2e396b0
Use Django DB instrumentation (#775)
tpyo Aug 30, 2019
2457a87
Check that url_rule is not None before dereferencing property (#781)
jtbeach Sep 3, 2019
af284a9
Implement Connection Strings for Azure Exporters (#767)
lzchen Sep 25, 2019
e5e752c
Update CHANGELOGs, bump Azure version for releases (#794)
lzchen Oct 1, 2019
3f01007
Trace exporter for Datadog (#793)
nbutton23 Oct 4, 2019
f4d8ec3
added isort support (#797)
dineshkrishnareddy Oct 8, 2019
c904f48
Typo (#800)
ArturTanona Oct 8, 2019
d7d31eb
Create README.rst for the Datadog trace exporter (#799)
nbutton23 Oct 14, 2019
b5d3a66
usage.rst: Replace nox-automation with nox (#803)
jayvdb Oct 15, 2019
e9129b7
Validate instrumentation key in Azure Exporters (#789)
lzchen Oct 23, 2019
75f853d
remove test (#824)
lzchen Nov 25, 2019
49495ae
Add optional custom properties to logging messages. (#822)
ivaramme Nov 26, 2019
228b5cf
docs: fix markdown-style links in rst readme (#828)
Chris-Johnston Dec 2, 2019
8fc960a
update changelog after 0.7.6 release (#829)
lzchen Dec 4, 2019
157af58
Remove coverage temporarily to unblock CI (#842)
lzchen Jan 15, 2020
22c1a28
Add custom_dimensions using kwargs instead of args (#837)
xinyi-joffre Jan 15, 2020
3b48294
Fix HTTP attributes for deps, fix success and response/resultCode for…
lzchen Jan 28, 2020
4d1d617
Add Fixed-rate sampling logic for Azure Log Exporter (#848)
lzchen Jan 28, 2020
4f4f020
Implement TelemetryProcessors for Azure exporters (#851)
lzchen Jan 29, 2020
e877825
Add local storage and retry logic for Azure Metrics Exporter + flush …
lzchen Jan 30, 2020
bb02e5b
update changelog from v0.7.7 release (#854)
lzchen Feb 21, 2020
99821a0
Rename long named tests + refactor tox/nox (#868)
lzchen Apr 7, 2020
d6114d7
Implement max size logic for local storage for Azure exporters (#876)
lzchen Jun 8, 2020
8eb82ef
Update CODEOWNERS (#906)
lzchen Jun 12, 2020
fce9d22
Update CODEOWNERS (#907)
lzchen Jun 12, 2020
7ec4ff6
Transport + storage changes (#903)
lzchen Jun 12, 2020
08c34fc
Add support to initialize azure exporters with proxies (#902)
skinamdar Jun 12, 2020
36b326a
Update async_.py (#910)
AndrewAXue Jun 16, 2020
1328fbf
Fix async.py is_exporter context (#909)
lzchen Jun 16, 2020
6e4b610
Update CHANGELOG for release v0.7.8 (#913)
lzchen Jun 17, 2020
c2bd5b0
update (#917)
lzchen Jun 18, 2020
05b1b99
Fix stackdriver tests (#921)
aabmass Jun 24, 2020
1846676
Add mean property for distribution value (#919)
marianhromiak Jun 25, 2020
07cb5f0
Add @aabmass to CODEOWNERs (#923)
lzchen Jun 26, 2020
86d5bd7
Remove dependencies/sec from performance counters for Azure (#922)
lzchen Jun 26, 2020
dea0794
Implement custom events in Azure (#925)
lzchen Jun 29, 2020
329b214
Use chain.from_iterable in span.py (#911)
cool-RR Jun 29, 2020
b7c7a67
Attach rate metrics via Heartbeat for Azure exporter (#930)
lzchen Jul 18, 2020
a4496dd
Attach rate metrics for VM (#935)
lzchen Jul 23, 2020
b332ae3
Change logger to module logger instance, rather than root logger (#938)
GuidoTournois Jul 27, 2020
862885a
Changing default transport for stackdriver exporter (#929)
aravinsiva Jul 29, 2020
6754bf4
Add a timeout to azure meta data service (#939)
lzchen Jul 30, 2020
9d6a607
Add links for trace exporter envelopes (#936)
lzchen Jul 30, 2020
67502e5
Azure Monitor metrics exporter atexit fixes (#943)
lzchen Aug 5, 2020
6d20b64
Add exception source data to logging output for easier debugging (#942)
briana-mcn Aug 10, 2020
e1d3c3b
Only ping azuremetadataservice if vm retry (#946)
lzchen Aug 12, 2020
e577df9
Configurable queue capacity for azure exporters (#949)
lzchen Sep 14, 2020
6721a56
Move heartbeat init logic into worker (#952)
lzchen Sep 23, 2020
0758877
Release for v0.7.11 (#958)
lzchen Oct 13, 2020
511289f
Revert "Release for v0.7.11 (#958)" (#959)
lzchen Oct 13, 2020
812105e
Fix comment, AsyncTransport is the default (#964)
TheJokersThief Oct 26, 2020
1517fbb
replace travis (part 1): add empty github workflow (#979)
aabmass Dec 4, 2020
868640c
Remove @c24t and @reyang from CODEOWNERS (#978)
lzchen Dec 4, 2020
0d01853
replace travis (part 2): run tests in github actions (#980)
aabmass Dec 5, 2020
577b176
test (#982)
lzchen Dec 7, 2020
a3931d9
Extract byte size from proto-plus messages (#976)
aabmass Dec 8, 2020
82deeb3
run CI workflow on master branch commits as well (#983)
aabmass Dec 8, 2020
2d16ea4
Remove blacklist sensitive language (#977)
lzchen Dec 9, 2020
82379aa
Disable heartbeat metrics in azure exporters (#984)
lzchen Dec 9, 2020
a7ebb74
Loosen ikey validation to follow GUID (#986)
lzchen Dec 14, 2020
f6c9bd4
Specify `google-cloud-trace<1.0.0` in README (#989)
busunkim96 Dec 17, 2020
d11f7ff
Merge branch 'master' of https://github.com/census-instrumentation/op…
lzchen Jan 14, 2021
60d3913
build
lzchen Jan 14, 2021
631e8ed
remove function
lzchen Jan 15, 2021
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# This file controls who is tagged for review for any given pull request.

# For anything not explicitly taken by someone else:
* @census-instrumentation/global-owners @aabmass @c24t @hectorhdzg @lzchen @reyang @songy23 @victoraugustolls
* @census-instrumentation/global-owners @aabmass @hectorhdzg @lzchen @songy23 @victoraugustolls
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build

on:
push:
branches-ignore:
- 'release/*'
pull_request:

jobs:
build:
# 18.04 needed for python3.4
runs-on: ubuntu-18.04
env:
# We use these variables to convert between tox and GHA version literals
py27: 2.7
py34: 3.4
py35: 3.5
py36: 3.6
py37: 3.7
strategy:
# ensures the entire test matrix is run, even if one permutation fails
fail-fast: false
matrix:
python-version: [py27, py34, py35, py36, py37]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python ${{ env[matrix.python-version] }}
uses: actions/setup-python@v2
with:
python-version: ${{ env[matrix.python-version] }}
- name: Install tox
run: pip install -U tox-factor
- name: Cache tox environment
uses: actions/cache@v2
with:
path: .tox
# bump version prefix to fully reset caches
key: v1-tox-${{ matrix.python-version }}-${{ hashFiles('tox.ini') }}
- name: run tox
run: tox -f ${{ matrix.python-version }}
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# run arbitrary code.
extension-pkg-whitelist=

# Add files or directories to the blacklist. They should be base names, not
# Add files or directories to the excludelist. They should be base names, not
# paths.
ignore=CVS

# Add files or directories matching the regex patterns to the blacklist. The
# Add files or directories matching the regex patterns to the excludelist. The
# regex matches against base names, not paths.
ignore-patterns=

Expand Down
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.7.12
Released 2021-01-14
- Change blacklist to excludelist
([#977](https://github.com/census-instrumentation/opencensus-python/pull/977))

## 0.7.11
Released 2020-10-13

Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ Customization

There are several things you can customize in OpenCensus:

* **Blacklist**, which excludes certain hosts and paths from being tracked.
* **Excludelist**, which excludes certain hosts and paths from being tracked.
By default, the health check path for the App Engine flexible environment is
not tracked, you can turn it on by excluding it from the blacklist setting.
not tracked, you can turn it on by excluding it from the excludelist setting.

* **Exporter**, which sends the traces.
By default, the traces are printed to stdout in JSON format. You can choose
Expand Down Expand Up @@ -174,8 +174,8 @@ information, please read the

'OPENCENSUS': {
'TRACE': {
'BLACKLIST_HOSTNAMES': ['localhost', '127.0.0.1'],
'BLACKLIST_PATHS': ['_ah/health'],
'EXCLUDELIST_HOSTNAMES': ['localhost', '127.0.0.1'],
'EXCLUDELIST_PATHS': ['_ah/health'],
'SAMPLER': 'opencensus.trace.samplers.ProbabilitySampler(rate=1)',
'EXPORTER': '''opencensus.ext.ocagent.trace_exporter.TraceExporter(
service_name='foobar',
Expand Down
8 changes: 8 additions & 0 deletions contrib/opencensus-ext-azure/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

## 1.0.6
Released 2021-01-14

- Disable heartbeat metrics in exporters
([#984](https://github.com/census-instrumentation/opencensus-python/pull/984))
- Loosen instrumentation key validation to GUID
([#984](https://github.com/census-instrumentation/opencensus-python/pull/984))

## 1.0.5
Released 2020-10-13

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, src, dst):

def run(self): # pragma: NO COVER
# Indicate that this thread is an exporter thread.
# Used to suppress tracking of requests in this thread.
# Used to suppress tracking of requests in this thread
execution_context.set_is_exporter(True)
src = self.src
dst = self.dst
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def _transmit(self, envelopes):
except Exception:
pass
if response.status_code == 200:
logger.info('Transmission succeeded: %s.', text)
return 0
if response.status_code == 206: # Partial Content
if data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ def timestamp_to_iso_str(timestamp):
return to_iso_str(datetime.datetime.utcfromtimestamp(timestamp))


# Validate UUID format
# Specs taken from https://tools.ietf.org/html/rfc4122
# Validate GUID format
uuid_regex_pattern = re.compile('^[0-9a-f]{8}-'
'[0-9a-f]{4}-'
'[1-5][0-9a-f]{3}-'
'[89ab][0-9a-f]{3}-'
'([0-9a-f]{4}-){3}'
'[0-9a-f]{12}$')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '1.0.5'
__version__ = '1.0.6'
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ def __init__(self, probability=1.0):
self.probability = probability

def filter(self, record):
return random.random() < self.probability
val = random.random()
print(val)
return val < self.probability


class AzureLogHandler(TransportMixin, ProcessorMixin, BaseLogHandler):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,4 @@ def new_metrics_exporter(**options):
producers,
exporter,
interval=exporter.options.export_interval)
from opencensus.ext.azure.metrics_exporter import heartbeat_metrics
heartbeat_metrics.enable_heartbeat_metrics(
exporter.options.connection_string,
exporter.options.instrumentation_key
)
return exporter
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def __init__(self, **options):
self._telemetry_processors = []
super(AzureExporter, self).__init__(**options)
atexit.register(self._stop, self.options.grace_period)
heartbeat_metrics.enable_heartbeat_metrics(
self.options.connection_string, self.options.instrumentation_key)

def span_data_to_envelope(self, sd):
envelope = Envelope(
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-azure/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
include_package_data=True,
long_description=open('README.rst').read(),
install_requires=[
'opencensus >= 0.7.11, < 1.0.0',
'opencensus >= 0.7.12, < 1.0.0',
'psutil >= 5.6.3',
'requests >= 2.19.0',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ def test_heartbeat_metric_init(self):
self.assertFalse(metric.init)
self.assertEqual(len(metric.properties), 0)

def test_heartbeat_metric_get_metric_init(self):
@mock.patch(
'requests.get',
throw(requests.exceptions.ConnectionError)
)
@mock.patch('os.environ.get')
def test_heartbeat_metric_get_metric_init(self, environ_mock):
environ_mock.return_value = None
metric = heartbeat_metrics.HeartbeatMetric()
self.assertFalse(metric.init)
metrics = metric.get_metrics()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def test_new_metrics_exporter_no_standard_metrics(self, exporter_mock):
self.assertFalse(isinstance(exporter_mock.call_args[0][0][0],
producer_class))

@unittest.skip("Skip because disabling heartbeat metrics")
@mock.patch('opencensus.ext.azure.metrics_exporter'
'.transport.get_exporter_thread')
def test_new_metrics_exporter_heartbeat(self, exporter_mock):
Expand Down
18 changes: 10 additions & 8 deletions contrib/opencensus-ext-azure/tests/test_azure_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ def test_invalid_key_section5_hex(self):
self.assertRaises(ValueError,
lambda: utils.validate_instrumentation_key(key))

def test_invalid_key_version(self):
key = '1234abcd-5678-6efa-8abc-1234567890ab'
self.assertRaises(ValueError,
lambda: utils.validate_instrumentation_key(key))
def test_valid_key_section2_hex(self):
key = '1234abcd-567a-4efa-8abc-1234567890ab'
self.assertIsNone(utils.validate_instrumentation_key(key))

def test_invalid_key_variant(self):
key = '1234abcd-5678-4efa-2abc-1234567890ab'
self.assertRaises(ValueError,
lambda: utils.validate_instrumentation_key(key))
def test_valid_key_section3_hex(self):
key = '1234abcd-5678-befa-8abc-1234567890ab'
self.assertIsNone(utils.validate_instrumentation_key(key))

def test_valid_key_section4_hex(self):
key = '1234abcd-5678-4efa-cabc-1234567890ab'
self.assertIsNone(utils.validate_instrumentation_key(key))
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-datadog/examples/datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

app = Flask(__name__)
middleware = FlaskMiddleware(app,
blacklist_paths=['/healthz'],
excludelist_paths=['/healthz'],
sampler=AlwaysOnSampler(),
exporter=DatadogTraceExporter(
Options(service='python-export-test',
Expand Down
6 changes: 6 additions & 0 deletions contrib/opencensus-ext-django/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 0.7.3
Released 2021-01-14

- Change blacklist to excludelist
([#977](https://github.com/census-instrumentation/opencensus-python/pull/977))

## 0.7.2
Released 2019-09-30

Expand Down
27 changes: 15 additions & 12 deletions contrib/opencensus-ext-django/opencensus/ext/django/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
REQUEST_THREAD_LOCAL_KEY = 'django_request'
SPAN_THREAD_LOCAL_KEY = 'django_span'

BLACKLIST_PATHS = 'BLACKLIST_PATHS'
BLACKLIST_HOSTNAMES = 'BLACKLIST_HOSTNAMES'
EXCLUDELIST_PATHS = 'EXCLUDELIST_PATHS'
EXCLUDELIST_HOSTNAMES = 'EXCLUDELIST_HOSTNAMES'

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -160,9 +160,12 @@ def __init__(self, get_response=None):
if isinstance(self.propagator, six.string_types):
self.propagator = configuration.load(self.propagator)

self.blacklist_paths = settings.get(BLACKLIST_PATHS, None)
self.excludelist_paths = settings.get(EXCLUDELIST_PATHS, None)

self.blacklist_hostnames = settings.get(BLACKLIST_HOSTNAMES, None)
self.excludelist_hostnames = settings.get(EXCLUDELIST_HOSTNAMES, None)

if django.VERSION >= (2,): # pragma: NO COVER
connection.execute_wrappers.append(_trace_db_call)

if django.VERSION >= (2,): # pragma: NO COVER
connection.execute_wrappers.append(_trace_db_call)
Expand All @@ -173,8 +176,8 @@ def process_request(self, request):
:type request: :class:`~django.http.request.HttpRequest`
:param request: Django http request.
"""
# Do not trace if the url is blacklisted
if utils.disable_tracing_url(request.path, self.blacklist_paths):
# Do not trace if the url is excludelisted
if utils.disable_tracing_url(request.path, self.excludelist_paths):
return

# Add the request to thread local
Expand All @@ -183,8 +186,8 @@ def process_request(self, request):
request)

execution_context.set_opencensus_attr(
'blacklist_hostnames',
self.blacklist_hostnames)
'excludelist_hostnames',
self.excludelist_hostnames)

try:
# Start tracing this request
Expand Down Expand Up @@ -234,8 +237,8 @@ def process_view(self, request, view_func, *args, **kwargs):
function name add set it as the span name.
"""

# Do not trace if the url is blacklisted
if utils.disable_tracing_url(request.path, self.blacklist_paths):
# Do not trace if the url is excludelisted
if utils.disable_tracing_url(request.path, self.excludelist_paths):
return

try:
Expand All @@ -248,8 +251,8 @@ def process_view(self, request, view_func, *args, **kwargs):
log.error('Failed to trace request', exc_info=True)

def process_response(self, request, response):
# Do not trace if the url is blacklisted
if utils.disable_tracing_url(request.path, self.blacklist_paths):
# Do not trace if the url is excludelisted
if utils.disable_tracing_url(request.path, self.excludelist_paths):
return response

try:
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-django/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
long_description=open('README.rst').read(),
install_requires=[
'Django >= 1.11',
'opencensus >= 0.7.0, < 1.0.0',
'opencensus >= 0.7.12, < 1.0.0',
],
extras_require={},
license='Apache-2.0',
Expand Down
12 changes: 6 additions & 6 deletions contrib/opencensus-ext-django/tests/test_django_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,17 @@ def test_process_request(self):

self.assertEqual(span.name, 'mock.mock.Mock')

def test_blacklist_path(self):
def test_excludelist_path(self):
from opencensus.ext.django import middleware

execution_context.clear()

blacklist_paths = ['test_blacklist_path']
excludelist_paths = ['test_excludelist_path']
settings = type('Test', (object,), {})
settings.OPENCENSUS = {
'TRACE': {
'SAMPLER': 'opencensus.trace.samplers.AlwaysOnSampler()', # noqa
'BLACKLIST_PATHS': blacklist_paths,
'EXCLUDELIST_PATHS': excludelist_paths,
'EXPORTER': mock.Mock(),
}
}
Expand All @@ -148,11 +148,11 @@ def test_blacklist_path(self):
with patch_settings:
middleware_obj = middleware.OpencensusMiddleware()

django_request = RequestFactory().get('/test_blacklist_path')
django_request = RequestFactory().get('/test_excludelist_path')
disabled = utils.disable_tracing_url(django_request.path,
blacklist_paths)
excludelist_paths)
self.assertTrue(disabled)
self.assertEqual(middleware_obj.blacklist_paths, blacklist_paths)
self.assertEqual(middleware_obj.excludelist_paths, excludelist_paths)

# test process_request
middleware_obj.process_request(django_request)
Expand Down
2 changes: 1 addition & 1 deletion contrib/opencensus-ext-django/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.7.2'
__version__ = '0.7.3'
Loading