public static function load()
    {
        if (!extension_loaded('opencensus')) {
            trigger_error('opencensus extension required to load pg integrations.', E_USER_WARNING);
            return;
        }

        // resource pg_connect ( string $connection_string [, int $connect_type ] )
        // resource pg_pconnect ( string $connection_string [, int $connect_type ] )
        opencensus_trace_function('pg_connect');
        opencensus_trace_function('pg_pconnect');

        // resource pg_query([resource $connection], string $query)
        opencensus_trace_function('pg_query', function () {
            $query = func_num_args() > 1
                ? func_get_arg(1)
                : func_get_arg(0);
            return [
                'attributes' => ['query' => $query],
                'kind' => Span::KIND_CLIENT
            ];
        });

        // resource pg_query_params([resource $connection], $string $query, array $params)
        opencensus_trace_function('pg_query_params', function () {
            $query = func_num_args() > 2
                ? func_get_arg(1)
                : func_get_arg(0);
            return [
                'attributes' => ['query' => $query],
                'kind' => Span::KIND_CLIENT
            ];
        });

        // resource pg_prepare ([ resource $connection ], string $stmtname , string $query )
        opencensus_trace_function('pg_prepare', function () {
            $statementName = func_num_args() > 2
                ? func_get_arg(1)
                : func_get_arg(0);
            $query = func_num_args() > 2
                ? func_get_arg(2)
                : func_get_arg(1);
            return [
                'attributes' => [
                    'statement' => $statementName,
                    'query' => $query
                ],
                'kind' => Span::KIND_CLIENT
            ];
        });

        // resource pg_execute([resource $connection], string $stmtname, array $params)
        opencensus_trace_function('pg_execute', function () {
            $statementName = func_num_args() > 2
                ? func_get_arg(1)
                : func_get_arg(0);
            return [
                'attributes' => ['statement' => $statementName],
                'kind' => Span::KIND_CLIENT
            ];
        });
    }