module ElasticAPM::Spies::AzureStorageTableSpy::Helpers

def instrument(operation_name, table_name = nil, service:)

def instrument(operation_name, table_name = nil, service:)
  span_name = span_name(operation_name, table_name)
  action = formatted_op_name(operation_name)
  account_name = account_name_from_storage_table_host(service.storage_service_host[:primary])
  destination = ElasticAPM::Span::Context::Destination.from_uri(service.storage_service_host[:primary])
  destination.service.resource = "#{SUBTYPE}/#{account_name}"
  context = ElasticAPM::Span::Context.new(destination: destination)
  ElasticAPM.with_span(span_name, TYPE, subtype: SUBTYPE, action: action, context: context) do
    ElasticAPM::Spies.without_faraday do
      ElasticAPM::Spies.without_net_http do
        yield
      end
    end
  end
end