|
| 1 | +# Copyright 2017, OpenCensus Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +import collections |
| 16 | + |
| 17 | +_SpanData = collections.namedtuple( |
| 18 | + '_SpanData', |
| 19 | + ( |
| 20 | + 'name', |
| 21 | + 'span_id', |
| 22 | + 'parent_span_id', |
| 23 | + 'attributes', |
| 24 | + 'start_time', |
| 25 | + 'end_time', |
| 26 | + 'stack_trace', |
| 27 | + 'time_events', |
| 28 | + 'links', |
| 29 | + 'status', |
| 30 | + 'same_process_as_parent_span', |
| 31 | + ), |
| 32 | +) |
| 33 | + |
| 34 | + |
| 35 | +class SpanData(_SpanData): |
| 36 | + """Immutable representation of all data collected by a |
| 37 | + :class: `~opencensus.trace.span.Span`. |
| 38 | +
|
| 39 | + :type name: str |
| 40 | + :param name: The name of the span. |
| 41 | +
|
| 42 | + :type span_id: int |
| 43 | + :param span_id: Identifier for the span, unique within a trace. |
| 44 | +
|
| 45 | + :type parent_span_id: int |
| 46 | + :param parent_span_id: (Optional) Parent span id. |
| 47 | +
|
| 48 | + :type attributes: dict |
| 49 | + :param attributes: Collection of attributes associated with the span. |
| 50 | +
|
| 51 | + :type start_time: str |
| 52 | + :param start_time: (Optional) Start of the time interval (inclusive) |
| 53 | + during which the trace data was collected from the |
| 54 | + application. |
| 55 | +
|
| 56 | + :type end_time: str |
| 57 | + :param end_time: (Optional) End of the time interval (inclusive) during |
| 58 | + which the trace data was collected from the application. |
| 59 | +
|
| 60 | + :type child_span_count: int |
| 61 | + :param child_span_count: the number of child spans that were |
| 62 | + generated while the span was active. |
| 63 | +
|
| 64 | + :type stack_trace: :class: `~opencensus.trace.stack_trace.StackTrace` |
| 65 | + :param stack_trace: (Optional) A call stack appearing in a trace |
| 66 | +
|
| 67 | + :type time_events: list |
| 68 | + :param time_events: (Optional) A set of time events. You can have up to 32 |
| 69 | + annotations and 128 message events per span. |
| 70 | +
|
| 71 | + :type links: list |
| 72 | + :param links: (Optional) Links associated with the span. You can have up |
| 73 | + to 128 links per Span. |
| 74 | +
|
| 75 | + :type status: :class: `~opencensus.trace.status.Status` |
| 76 | + :param status: (Optional) An optional final status for this span. |
| 77 | +
|
| 78 | + :type same_process_as_parent_span: bool |
| 79 | + :param same_process_as_parent_span: (Optional) A highly recommended but not |
| 80 | + required flag that identifies when a |
| 81 | + trace crosses a process boundary. |
| 82 | + True when the parent_span belongs to |
| 83 | + the same process as the current span. |
| 84 | +
|
| 85 | + """ |
| 86 | + __slots__ = () |
0 commit comments