Utils#

This module includes utility functions designed for statistics collection.

The functions below can be used to configure the opentelemetry destination.

set_logger_destination(OTLPLogExporter("grpc://localhost:4317", insecure=True))
set_tracer_destination(OTLPSpanExporter("grpc://localhost:4317", insecure=True))
resource = <opentelemetry.sdk.resources.Resource object>#

Singletone Resource instance shared inside the framework.

tracer_provider = <opentelemetry.sdk.trace.TracerProvider object>#

Global tracer provider bound to the Chatsky resource.

logger_provider = <opentelemetry.sdk._logs._internal.LoggerProvider object>#

Global logger provider bound to the Chatsky resource.

set_logger_destination(exporter=None)[source]#

Configure the global Opentelemetry logger provider to export logs to the given destination.

Parameters:

exporter (Optional[LogExporter]) – Opentelemetry log exporter instance.

set_meter_destination(exporter=None)[source]#

Configure the global Opentelemetry meter provider to export metrics to the given destination.

Parameters:

exporter (Optional[MetricExporter]) – Opentelemetry meter exporter instance.

set_tracer_destination(exporter=None)[source]#

Configure the global Opentelemetry tracer provider to export traces to the given destination.

Parameters:

exporter (Optional[SpanExporter]) – Opentelemetry span exporter instance.

get_extra_handler_name(info, postfix='')[source]#

This function can be used to obtain a key, under which the wrapper data will be stored in the context.

Parameters:
  • info (ExtraHandlerRuntimeInfo) – Handler runtime info obtained from the pipeline.

  • postfix (str) – Field-specific postfix that will be appended to the field name.

Return type:

str

get_superset_session(args, base_url='http://localhost:8088/')[source]#

Utility function for authorized interaction with Superset HTTP API.

Parameters:
  • args (Namespace) – Command line arguments including Superset username and Superset password.

  • base_url (str) – Base Superset URL.

Return type:

Tuple[Session, dict]

Returns:

Authorized session - authorization headers tuple.

drop_superset_assets(session, headers, base_url)[source]#

Drop the existing assets from the Superset dashboard.

Parameters:
  • session (Session) – Authorized Superset session.

  • headers (dict) – Superset session headers.

  • base_url (str) – Base Superset URL.

class PasswordAction(option_strings, dest=None, nargs=0, default=None, required=False, type=None, metavar=None, help=None)[source]#

Bases: Action

Child class for Argparse’s Action that prompts users for passwords interactively, ensuring password safety, unless the password is specified directly.

__call__(parser, args, values, option_string=None)[source]#

Call self as a function.