google-cloud-logging 3.11.2__tar.gz → 3.11.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_cloud_logging-3.11.2/google_cloud_logging.egg-info → google_cloud_logging-3.11.3}/PKG-INFO +1 -1
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging/gapic_version.py +1 -1
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/gapic_version.py +1 -1
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/_helpers.py +22 -2
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3/google_cloud_logging.egg-info}/PKG-INFO +1 -1
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test__helpers.py +37 -14
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test_handlers.py +4 -3
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test_structured_log.py +4 -3
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/LICENSE +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/MANIFEST.in +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/README.rst +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging/handlers/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging/handlers/middleware/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging/handlers/transports/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging/py.typed +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/_gapic.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/_helpers.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/_http.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/_instrumentation.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/entries.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/gapic_metadata.json +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/_monitored_resources.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/app_engine.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/container_engine.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/handlers.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/middleware/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/middleware/request.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/structured_log.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/transports/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/transports/background_thread.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/transports/base.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/handlers/transports/sync.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/logger.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/metric.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/py.typed +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/resource.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/async_client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/pagers.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/transports/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/transports/base.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/async_client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/pagers.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/transports/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/transports/base.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/async_client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/pagers.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/transports/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/sink.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/types/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/types/log_entry.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/types/logging.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/types/logging_config.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/types/logging_metrics.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google_cloud_logging.egg-info/SOURCES.txt +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google_cloud_logging.egg-info/dependency_links.txt +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google_cloud_logging.egg-info/not-zip-safe +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google_cloud_logging.egg-info/requires.txt +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google_cloud_logging.egg-info/top_level.txt +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/setup.cfg +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/setup.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/performance/noxfile.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/performance/test_performance.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/system/gapic/v2/test_system_logging_service_v2_v2.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/system/test_system.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/gapic/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/gapic/logging_v2/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/gapic/logging_v2/test_config_service_v2.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/gapic/logging_v2/test_logging_service_v2.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/middleware/test_request.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test__monitored_resources.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test_app_engine.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test_container_engine.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/transports/__init__.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/transports/test_background_thread.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/transports/test_base.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/transports/test_sync.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test__gapic.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test__helpers.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test__http.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test__instrumentation.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test_client.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test_entries.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test_logger.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test_logging_shim.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test_metric.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test_packaging.py +0 -0
- {google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test_sink.py +0 -0
|
@@ -174,13 +174,22 @@ def _parse_xcloud_trace(header):
|
|
|
174
174
|
Args:
|
|
175
175
|
header (str): the string extracted from the X_CLOUD_TRACE header
|
|
176
176
|
Returns:
|
|
177
|
-
Tuple[Optional[
|
|
177
|
+
Tuple[Optional[str], Optional[str], bool]:
|
|
178
178
|
The trace_id, span_id and trace_sampled extracted from the header
|
|
179
179
|
Each field will be None if not found.
|
|
180
180
|
"""
|
|
181
181
|
trace_id = span_id = None
|
|
182
182
|
trace_sampled = False
|
|
183
|
-
|
|
183
|
+
|
|
184
|
+
# As per the format described at https://cloud.google.com/trace/docs/trace-context#legacy-http-header
|
|
185
|
+
# "X-Cloud-Trace-Context: TRACE_ID[/SPAN_ID][;o=OPTIONS]"
|
|
186
|
+
# for example:
|
|
187
|
+
# "X-Cloud-Trace-Context: 105445aa7843bc8bf206b12000100000/1;o=1"
|
|
188
|
+
#
|
|
189
|
+
# We expect:
|
|
190
|
+
# * trace_id (optional, 128-bit hex string): "105445aa7843bc8bf206b12000100000"
|
|
191
|
+
# * span_id (optional, 16-bit hex string): "0000000000000001" (needs to be converted into 16 bit hex string)
|
|
192
|
+
# * trace_sampled (optional, bool): true
|
|
184
193
|
if header:
|
|
185
194
|
try:
|
|
186
195
|
regex = r"([\w-]+)?(\/?([\w-]+))?(;?o=(\d))?"
|
|
@@ -188,6 +197,17 @@ def _parse_xcloud_trace(header):
|
|
|
188
197
|
trace_id = match.group(1)
|
|
189
198
|
span_id = match.group(3)
|
|
190
199
|
trace_sampled = match.group(5) == "1"
|
|
200
|
+
|
|
201
|
+
# Convert the span ID to 16-bit hexadecimal instead of decimal
|
|
202
|
+
try:
|
|
203
|
+
span_id_int = int(span_id)
|
|
204
|
+
if span_id_int > 0 and span_id_int < 2**64:
|
|
205
|
+
span_id = f"{span_id_int:016x}"
|
|
206
|
+
else:
|
|
207
|
+
span_id = None
|
|
208
|
+
except (ValueError, TypeError):
|
|
209
|
+
span_id = None
|
|
210
|
+
|
|
191
211
|
except IndexError:
|
|
192
212
|
pass
|
|
193
213
|
return trace_id, span_id, trace_sampled
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test__helpers.py
RENAMED
|
@@ -25,9 +25,13 @@ from tests.unit.handlers import (
|
|
|
25
25
|
|
|
26
26
|
_FLASK_TRACE_ID = "flask0id"
|
|
27
27
|
_FLASK_SPAN_ID = "span0flask"
|
|
28
|
+
_FLASK_SPAN_ID_XCTC_DEC = "12345"
|
|
29
|
+
_FLASK_SPAN_ID_XCTC_HEX = "3039".zfill(16)
|
|
28
30
|
_FLASK_HTTP_REQUEST = {"requestUrl": "https://flask.palletsprojects.com/en/1.1.x/"}
|
|
29
31
|
_DJANGO_TRACE_ID = "django0id"
|
|
30
32
|
_DJANGO_SPAN_ID = "span0django"
|
|
33
|
+
_DJANGO_SPAN_ID_XCTC_DEC = "54321"
|
|
34
|
+
_DJANGO_SPAN_ID_XCTC_HEX = "d431".zfill(16)
|
|
31
35
|
_DJANGO_HTTP_REQUEST = {"requestUrl": "https://www.djangoproject.com/"}
|
|
32
36
|
|
|
33
37
|
|
|
@@ -64,8 +68,9 @@ class Test_get_request_data_from_flask(unittest.TestCase):
|
|
|
64
68
|
def test_xcloud_header(self):
|
|
65
69
|
flask_trace_header = "X_CLOUD_TRACE_CONTEXT"
|
|
66
70
|
expected_trace_id = _FLASK_TRACE_ID
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
input_span_id = _FLASK_SPAN_ID_XCTC_DEC
|
|
72
|
+
expected_span_id = _FLASK_SPAN_ID_XCTC_HEX
|
|
73
|
+
flask_trace_id = f"{expected_trace_id}/{input_span_id};o=1"
|
|
69
74
|
|
|
70
75
|
app = self.create_app()
|
|
71
76
|
context = app.test_request_context(
|
|
@@ -173,9 +178,10 @@ class Test_get_request_data_from_django(unittest.TestCase):
|
|
|
173
178
|
from google.cloud.logging_v2.handlers.middleware import request
|
|
174
179
|
|
|
175
180
|
django_trace_header = "HTTP_X_CLOUD_TRACE_CONTEXT"
|
|
176
|
-
|
|
181
|
+
input_span_id = _DJANGO_SPAN_ID_XCTC_DEC
|
|
182
|
+
expected_span_id = _DJANGO_SPAN_ID_XCTC_HEX
|
|
177
183
|
expected_trace_id = _DJANGO_TRACE_ID
|
|
178
|
-
django_trace_id = f"{expected_trace_id}/{
|
|
184
|
+
django_trace_id = f"{expected_trace_id}/{input_span_id};o=1"
|
|
179
185
|
|
|
180
186
|
django_request = RequestFactory().get(
|
|
181
187
|
"/", **{django_trace_header: django_trace_id}
|
|
@@ -501,25 +507,40 @@ class Test__parse_xcloud_trace(unittest.TestCase):
|
|
|
501
507
|
self.assertEqual(sampled, False)
|
|
502
508
|
|
|
503
509
|
def test_no_trace(self):
|
|
504
|
-
|
|
510
|
+
input_span = "12345"
|
|
511
|
+
expected_span = "3039".zfill(16)
|
|
512
|
+
header = f"/{input_span}"
|
|
505
513
|
trace_id, span_id, sampled = self._call_fut(header)
|
|
506
514
|
self.assertIsNone(trace_id)
|
|
507
|
-
self.assertEqual(span_id,
|
|
515
|
+
self.assertEqual(span_id, expected_span)
|
|
508
516
|
self.assertEqual(sampled, False)
|
|
509
517
|
|
|
510
518
|
def test_with_span(self):
|
|
511
519
|
expected_trace = "12345"
|
|
512
|
-
|
|
513
|
-
|
|
520
|
+
input_span = "67890"
|
|
521
|
+
expected_span = "10932".zfill(16)
|
|
522
|
+
header = f"{expected_trace}/{input_span}"
|
|
514
523
|
trace_id, span_id, sampled = self._call_fut(header)
|
|
515
524
|
self.assertEqual(trace_id, expected_trace)
|
|
516
525
|
self.assertEqual(span_id, expected_span)
|
|
517
526
|
self.assertEqual(sampled, False)
|
|
518
527
|
|
|
528
|
+
def test_with_span_decimal_not_in_bounds(self):
|
|
529
|
+
input_spans = ["0", "9" * 100]
|
|
530
|
+
|
|
531
|
+
for input_span in input_spans:
|
|
532
|
+
expected_trace = "12345"
|
|
533
|
+
header = f"{expected_trace}/{input_span}"
|
|
534
|
+
trace_id, span_id, sampled = self._call_fut(header)
|
|
535
|
+
self.assertEqual(trace_id, expected_trace)
|
|
536
|
+
self.assertIsNone(span_id)
|
|
537
|
+
self.assertEqual(sampled, False)
|
|
538
|
+
|
|
519
539
|
def test_with_extra_characters(self):
|
|
520
540
|
expected_trace = "12345"
|
|
521
|
-
|
|
522
|
-
|
|
541
|
+
input_span = "67890"
|
|
542
|
+
expected_span = "10932".zfill(16)
|
|
543
|
+
header = f"{expected_trace}/{input_span};abc"
|
|
523
544
|
trace_id, span_id, sampled = self._call_fut(header)
|
|
524
545
|
self.assertEqual(trace_id, expected_trace)
|
|
525
546
|
self.assertEqual(span_id, expected_span)
|
|
@@ -527,8 +548,9 @@ class Test__parse_xcloud_trace(unittest.TestCase):
|
|
|
527
548
|
|
|
528
549
|
def test_with_explicit_no_sampled(self):
|
|
529
550
|
expected_trace = "12345"
|
|
530
|
-
|
|
531
|
-
|
|
551
|
+
input_span = "67890"
|
|
552
|
+
expected_span = "10932".zfill(16)
|
|
553
|
+
header = f"{expected_trace}/{input_span};o=0"
|
|
532
554
|
trace_id, span_id, sampled = self._call_fut(header)
|
|
533
555
|
self.assertEqual(trace_id, expected_trace)
|
|
534
556
|
self.assertEqual(span_id, expected_span)
|
|
@@ -536,8 +558,9 @@ class Test__parse_xcloud_trace(unittest.TestCase):
|
|
|
536
558
|
|
|
537
559
|
def test_with__sampled(self):
|
|
538
560
|
expected_trace = "12345"
|
|
539
|
-
|
|
540
|
-
|
|
561
|
+
input_span = "67890"
|
|
562
|
+
expected_span = "10932".zfill(16)
|
|
563
|
+
header = f"{expected_trace}/{input_span};o=1"
|
|
541
564
|
trace_id, span_id, sampled = self._call_fut(header)
|
|
542
565
|
self.assertEqual(trace_id, expected_trace)
|
|
543
566
|
self.assertEqual(span_id, expected_span)
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test_handlers.py
RENAMED
|
@@ -140,7 +140,7 @@ class TestCloudLoggingFilter(unittest.TestCase):
|
|
|
140
140
|
self.assertIsNone(record._labels)
|
|
141
141
|
self.assertEqual(record._labels_str, "{}")
|
|
142
142
|
|
|
143
|
-
def
|
|
143
|
+
def test_record_with_xctc_request(self):
|
|
144
144
|
"""
|
|
145
145
|
test filter adds http request data when available
|
|
146
146
|
"""
|
|
@@ -161,8 +161,9 @@ class TestCloudLoggingFilter(unittest.TestCase):
|
|
|
161
161
|
expected_path = "http://testserver/123"
|
|
162
162
|
expected_agent = "Mozilla/5.0"
|
|
163
163
|
expected_trace = "123"
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
input_span = "456"
|
|
165
|
+
expected_span = "1c8".zfill(16)
|
|
166
|
+
combined_trace = f"{expected_trace}/{input_span};o=1"
|
|
166
167
|
expected_request = {
|
|
167
168
|
"requestMethod": "GET",
|
|
168
169
|
"requestUrl": expected_path,
|
|
@@ -382,7 +382,7 @@ class TestStructuredLogHandler(unittest.TestCase):
|
|
|
382
382
|
result = handler.format(record)
|
|
383
383
|
self.assertIn(expected_result, result)
|
|
384
384
|
|
|
385
|
-
def
|
|
385
|
+
def test_format_with_xctc_request(self):
|
|
386
386
|
import logging
|
|
387
387
|
import json
|
|
388
388
|
|
|
@@ -393,8 +393,9 @@ class TestStructuredLogHandler(unittest.TestCase):
|
|
|
393
393
|
expected_path = "http://testserver/123"
|
|
394
394
|
expected_agent = "Mozilla/5.0"
|
|
395
395
|
expected_trace = "123"
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
input_span = "456"
|
|
397
|
+
expected_span = "1c8".zfill(16)
|
|
398
|
+
trace_header = f"{expected_trace}/{input_span};o=1"
|
|
398
399
|
expected_payload = {
|
|
399
400
|
"logging.googleapis.com/trace": expected_trace,
|
|
400
401
|
"logging.googleapis.com/spanId": expected_span,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/__init__.py
RENAMED
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/_gapic.py
RENAMED
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/_helpers.py
RENAMED
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/_http.py
RENAMED
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/client.py
RENAMED
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/entries.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/logger.py
RENAMED
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/metric.py
RENAMED
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/py.typed
RENAMED
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/resource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/google/cloud/logging_v2/types/logging.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/performance/test_performance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/gapic/logging_v2/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/handlers/test_app_engine.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_cloud_logging-3.11.2 → google_cloud_logging-3.11.3}/tests/unit/test__instrumentation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|