PageRenderTime 58ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/@opencensus/core/build/src/trace/model/span-base.d.ts

https://gitlab.com/varunsonavne/node-hello
TypeScript Typings | 131 lines | 44 code | 0 blank | 87 comment | 2 complexity | 1f3f03695040b53515e3850c7a0dca3d MD5 | raw file
  1. /**
  2. * Copyright 2018, OpenCensus Authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import { Logger } from '../../common/types';
  17. import * as configTypes from '../config/types';
  18. import * as types from './types';
  19. /** Defines a base model for spans. */
  20. export declare abstract class SpanBase implements types.Span {
  21. protected className: string;
  22. /** The clock used to mesure the beginning and ending of a span */
  23. private clock;
  24. /** Indicates if this span was started */
  25. private startedLocal;
  26. /** Indicates if this span was ended */
  27. private endedLocal;
  28. /** Indicates if this span was forced to end */
  29. private truncated;
  30. /** The Span ID of this span */
  31. readonly id: string;
  32. /** An object to log information to */
  33. logger: Logger;
  34. /** A set of attributes, each in the format [KEY]:[VALUE] */
  35. attributes: types.Attributes;
  36. /** A text annotation with a set of attributes. */
  37. annotations: types.Annotation[];
  38. /** An event describing a message sent/received between Spans */
  39. messageEvents: types.MessageEvent[];
  40. /** Pointers from the current span to another span */
  41. links: types.Link[];
  42. /** If the parent span is in another process. */
  43. remoteParent: boolean;
  44. /** The span ID of this span's parent. If it's a root span, must be empty */
  45. parentSpanId: string;
  46. /** The resource name of the span */
  47. name: string;
  48. /** Kind of span. */
  49. kind: types.SpanKind;
  50. /** A final status for this span */
  51. status: types.Status;
  52. /** set isRootSpan */
  53. abstract readonly isRootSpan: boolean;
  54. /** Trace Parameters */
  55. activeTraceParams: configTypes.TraceParams;
  56. /** The number of dropped attributes. */
  57. droppedAttributesCount: number;
  58. /** The number of dropped links. */
  59. droppedLinksCount: number;
  60. /** The number of dropped annotations. */
  61. droppedAnnotationsCount: number;
  62. /** The number of dropped message events. */
  63. droppedMessageEventsCount: number;
  64. /** Constructs a new SpanBaseModel instance. */
  65. constructor();
  66. /** Gets the trace ID. */
  67. abstract readonly traceId: string;
  68. /** Gets the trace state */
  69. abstract readonly traceState: types.TraceState;
  70. /** Indicates if span was started. */
  71. readonly started: boolean;
  72. /** Indicates if span was ended. */
  73. readonly ended: boolean;
  74. /**
  75. * Gives a timestamp that indicates the span's start time in RFC3339 UTC
  76. * "Zulu" format.
  77. */
  78. readonly startTime: Date;
  79. /**
  80. * Gives a timestap that indicates the span's end time in RFC3339 UTC
  81. * "Zulu" format.
  82. */
  83. readonly endTime: Date;
  84. /**
  85. * Gives a timestap that indicates the span's duration in RFC3339 UTC
  86. * "Zulu" format.
  87. */
  88. readonly duration: number;
  89. /** Gives the TraceContext of the span. */
  90. readonly spanContext: types.SpanContext;
  91. /**
  92. * Adds an atribute to the span.
  93. * @param key Describes the value added.
  94. * @param value The result of an operation.
  95. */
  96. addAttribute(key: string, value: string | number | boolean): void;
  97. /**
  98. * Adds an annotation to the span.
  99. * @param description Describes the event.
  100. * @param attributes A set of attributes on the annotation.
  101. * @param timestamp A time, in milliseconds. Defaults to Date.now()
  102. */
  103. addAnnotation(description: string, attributes?: types.Attributes, timestamp?: number): void;
  104. /**
  105. * Adds a link to the span.
  106. * @param traceId The trace ID for a trace within a project.
  107. * @param spanId The span ID for a span within a trace.
  108. * @param type The relationship of the current span relative to the linked.
  109. * @param attributes A set of attributes on the link.
  110. */
  111. addLink(traceId: string, spanId: string, type: types.LinkType, attributes?: types.Attributes): void;
  112. /**
  113. * Adds a message event to the span.
  114. * @param type The type of message event.
  115. * @param id An identifier for the message event.
  116. * @param timestamp A time in milliseconds. Defaults to Date.now()
  117. */
  118. addMessageEvent(type: types.MessageEventType, id: string, timestamp?: number): void;
  119. /**
  120. * Sets a status to the span.
  121. * @param code The canonical status code.
  122. * @param message optional A developer-facing error message.
  123. */
  124. setStatus(code: types.CanonicalCode, message?: string): void;
  125. /** Starts the span. */
  126. start(): void;
  127. /** Ends the span. */
  128. end(): void;
  129. /** Forces the span to end. */
  130. truncate(): void;
  131. }