NewSpan
NewSpan creates a new span with the given service name and span name.
def NewSpan(
ctx: context.Context,
serviceName: string,
spanName: string
) - > tuple[context.Context, rawtrace.Span]
Creates a new span with the given service name and span name. This function is used to initiate a new tracing span within a specific service context, allowing for detailed performance monitoring and distributed tracing.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context object, potentially containing existing trace information or log fields that will be added as attributes to the new span. |
| serviceName | string | The name of the service associated with this span, used to identify the source of the trace. |
| spanName | string | The name of the span, providing a descriptive label for the operation being traced. |
Returns
| Type | Description |
|---|---|
tuple[context.Context, rawtrace.Span] | A tuple containing the updated context with the new span and the rawtrace.Span object itself. |