summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-05-24 14:27:07 +0000
committerGerrit Code Review <review@openstack.org>2017-05-24 14:27:07 +0000
commit79d81f62e79a54aa45d2c1eb4e38d3d625f91687 (patch)
tree35925206082e5494cd074f5c21901f662a5143ab
parenta0903622a2911d7bc89b6418141909bdb2429ea4 (diff)
parentcce83ad5e12baf2edc0e12c2944c587224e71148 (diff)
downloadoslo-context-79d81f62e79a54aa45d2c1eb4e38d3d625f91687.tar.gz
Merge "Provide unified calling interface for global_id"2.14.0
-rw-r--r--oslo_context/context.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/oslo_context/context.py b/oslo_context/context.py
index c253b32..cc88ff6 100644
--- a/oslo_context/context.py
+++ b/oslo_context/context.py
@@ -345,6 +345,16 @@ class RequestContext(object):
values.update(self.to_dict())
return values
+ @property
+ def global_id(self):
+ """Return a sensible value for global_id to pass on.
+
+ When we want to make a call with to another service, it's
+ important that we try to use global_request_id if available,
+ and fall back to the locally generated request_id if not.
+ """
+ return self.global_request_id or self.request_id
+
@classmethod
def from_dict(cls, values, **kwargs):
"""Construct a context object from a provided dictionary."""