diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-05-24 14:27:07 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-05-24 14:27:07 +0000 |
commit | 79d81f62e79a54aa45d2c1eb4e38d3d625f91687 (patch) | |
tree | 35925206082e5494cd074f5c21901f662a5143ab | |
parent | a0903622a2911d7bc89b6418141909bdb2429ea4 (diff) | |
parent | cce83ad5e12baf2edc0e12c2944c587224e71148 (diff) | |
download | oslo-context-79d81f62e79a54aa45d2c1eb4e38d3d625f91687.tar.gz |
Merge "Provide unified calling interface for global_id"2.14.0
-rw-r--r-- | oslo_context/context.py | 10 |
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.""" |